Java OCA OCP Practice Question 1434

Question

In which places is the default keyword permitted to be used? (Choose two.)

  • A. Access modifier in a class
  • B. Execution path in a switch statement
  • C. Method name
  • D. Modifier in an abstract interface method
  • E. Modifier in an interface method with a body
  • F. Variable name


B, E.

Note

Package-private, or default, access is denoted by the absence of an access modifier, making Option A incorrect.

Option B is correct, since a switch statement can contain a default execution path.

Options C and F are incorrect because keywords in Java cannot be used as method or variable names.

The interfaces can contain default interface methods but they must be concrete with a method body.

Option E is correct and Option D is incorrect.




PreviousNext

Related