Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Lesson_29_Activity_One {
- public static String [] list = {"high", "every", "nearing", "checking", "food ", "stand", "value", "best", "energy", "add", "grand", "notation", "abducted", "food ", "stand"};
- public static void main(String[] args) {
- int length[] = new int[list.length];
- int prevlargest = 0;
- String indexoflargest = null;
- for(int i = 0; i < list.length; i++) {
- length[i] = list[i].length();
- if(length[i] > prevlargest) {
- prevlargest = length[i];
- indexoflargest = list[i];
- }
- }
- System.out.println(indexoflargest);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement