Challenge for More About ArrayList
Challenge
What number will the following code print out?
ArrayList<String> fruits = new ArrayList<String>();
fruits.add("apple");
fruits.add("banana");
fruits.add("cantaloupe");
fruits.remove("apple");
int h = fruits.indexOf("honeydew");
int c = fruits.indexOf("cantaloupe");
System.out.println(h+c);
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.