Java OCA OCP Practice Question 1364

Question

Which of the following substitutions will compile? (Choose two.)

public class Main { 
   public String name = "main"; 
   public void massage() { 
      int zip = 10017; 
   } 
} 
  • A. Change name to _name
  • B. Change 10017 to _10017
  • C. Change 10017 to 10017_
  • D. Change 10017 to 10_0_17
  • E. Change int to _int


A, D.

Note

Variable names can begin with an underscore, making Option A correct.

To use an underscore in a numeric literal, it must be between two digits.

Option D is correct.




PreviousNext

Related