Java OCA OCP Practice Question 248

Question

Which of the following is true about String instance variables?

  • A. They can be set to null.
  • B. They can never be set from outside the class they are defined in.
  • C. They can only be set in the constructor.
  • D. They can only be set once per run of the program.


A.

Note

Assuming the variables are not primitives, they allow a null assignment.

The other statements are false.




PreviousNext

Related