Suppose an ArrayList list contains {“red”, “red”, “green”}….

Suppose an ArrayList list contains {“red”, “red”, “green”}. What is the list after the following code? String element = “red”; for (int i = list.size() – 1; i >= 0; i–) if (list.get(i).equals(element)) list.remove(element);

The getValue() method is overridden in two ways. Which one i…

The getValue() method is overridden in two ways. Which one is correct? I: public class Test { public static void main(String args) { A a = new A(); System.out.println(a.getValue()); } } class B { public Object getValue() { return “Any object”; } } class A extends B { public String getValue() { return “A string”; } }

Suppose an ArrayList list contains {“red”, “red”, “green”}….

Suppose an ArrayList list contains {“red”, “red”, “green”}. What is the list after the following code? String element = “red”; for (int i = 0; i < list.size(); i++)   if (list.get(i).equals(element)) list.remove(element);