Question: 09. What is the output of this program? public class Java1109 public static void main(String args[ D { ArrayList numbers = new ArrayList(); numbers.add(new Integer(11));

 09. What is the output of this program? public class Java1109

public static void main(String args[ D { ArrayList numbers = new ArrayList();

numbers.add(new Integer(11)); numbers.add(new Integer(22)); numbers.add(new Integer(33)); numbers.add(new Integer(44)); numbers.add(new Integer(55)); System.out.println(numbers); }

09. What is the output of this program? public class Java1109 public static void main(String args[ D { ArrayList numbers = new ArrayList(); numbers.add(new Integer(11)); numbers.add(new Integer(22)); numbers.add(new Integer(33)); numbers.add(new Integer(44)); numbers.add(new Integer(55)); System.out.println(numbers); } (A) 11 22 33 44 55 (B) 55 (C) (D) 11 22 33 44 55 [11, 22, 33, 44, 55) Error (E) 10. Java provides wrapper classes, which create objects that store primitive data types. Which of the following are Java wrapper classes? (A) (B) (C) int, double, boolean, string int, double, boolean Integer, Double, Boolean integer, real, logic Integer, Double, Boolean, String (D) (E) 11. Which of the following statements correctly uses a wrapper class to store a primitive data type? (A) (B) (C) intList.add(new Integer(1000)); doubleList.add(new Double(123.321)); logicList(add(new Boolean(true)); All of the above. (D) 12. What is the output of this program? import java.util.ArrayList; public class Java1112 public static void main(String args[]) ArrayList numbers = new ArrayList(); int k; for (k = 1; k list = new ArrayList0; ? (A) (B) (C) (D) list is an ArrayList object. Elements of the list array are objects. The type of objects stored by list are Integer objects. The number of array elements is not specified. (E) All of the above 15. What is guaranteed by a generic declaration like the one shown below? ArrayList list = new ArrayList0; (A) ArrayIndexOutOfBounds error will not happen. (B) There will not be any compile errors due to wrong data types. (C) At execution time every element of list will store a String object. (D) Improper access to any list member is not possible. (E) All of the above Consider the following program segment. 16. ArrayList reals = new ArrayList0; list2.add(400.0); list2.add(500.0); list2.add(600.0); Which of the following statements demonstrates the use of generics? (A) (B) (C) (D) Double real = reals.get(0); double real (reals.get(0)).doubleValue(); double real = ((Double)reals.get(0)).doubleValue(); Double real = (Double)reals.get(0)); (E) Both A & B 17. Consider the following Person class. class Person { private String name; private int age; public Person (String n, int a) { namen; age = a; } } Which of the following statements correctly declares a generic ArrayList object of Person objects? (A) (B) (C) (D) (E) ArrayList people = new ArrayList0; ArrayList people = new Person(); Person people = new ArrayList(); ArrayList people = new ArrayList(Person); ArrayList people = new ArrayList()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!