Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Print Longest String
class Rextester { public static void main(String args[]) { String input = "Cheese Pepperoni Olives Armagggeddonh"; String [] a = input.split(" "); int maxLength = 0; String longestString = null; for (String s : a) { if (s.length() > maxLength){ maxLength = s.length(); longestString = s; } } System.out.println("Longestn string: "+ longestString); } }
run
|
edit
|
history
|
help
0
Tree ZigZag Traversal
3.c
4.a
Arredondamento de datas para dias 10, 20 e 30
stringkeyvalues
1.5
rta
rextester.java1
Fibonacci number 0 - 93
H