java - Writing a method with ArrayList parameter + for-each loop -


Hello people, amazing people of stack overflow.

This is my first time posting so I apologize to anyone before any mistake!

The question for this assignment is:

Write a permanent method method for the longest, which is passed an ArrayList of the strings, and in the array The longest string, an int (of course, can be the longest value in many). You have to use each loop in your solution.

This is my code:

  public stable the longest (string [] data) {int longString = 0; (String s: for data) (if (s.length ()> long string) longString = s.length ();} Return long string;}  

I deposit the HV I get a normal compiler error in the box - no special I have seen my code for one hour and I do not know what is wrong. I like it: - (

Any and all The advice will be highly appreciated! Thank you!

This code just fine. Do not respond to your requirement - ArrayList :

 (string s: data) {if (s.length ()> String} longString = s.length ();} return long string (string s: data) {int longString = 0;;}  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -