Java OCA OCP Practice Question 718

Question

Given the following line of code:

List students = new ArrayList (); 

Identify the correct statement:

Select 1 option

  • A. The reference type is List and the object type is ArrayList.
  • B. The reference type is ArrayList and the object type is ArrayList.
  • C. The reference type is ArrayList and the object type is List.
  • D. The reference type is List and the object type is List.


Correct Option is  : A

Note

Since you are doing new ArrayList, you are creating an object of class ArrayList.

You are assigning this object to variable "students", which is declared of class List. Reference type means the declared type of the variable.




PreviousNext

Related