Java OCA OCP Practice Question 908

Question

Which of these compile when replacing line 8?

Choose all that apply

7: char[]c = new char[2]; 
8: // INSERT CODE HERE 
  • A. int length = c.capacity;
  • B. int length = c.capacity();
  • C. int length = c.length;
  • D. int length = c.length();
  • E. int length = c.size;
  • F. int length = c.size();
  • G. None of the above.


C.

Note

Arrays define a property called length.

It is not a method, so parentheses are not allowed.




PreviousNext

Related