Java OCA OCP Practice Question 82

Question

Which of the following may follow the static keyword? (Choose all that apply.)

  • A. Class definitions
  • B. Data
  • C. Methods
  • D. Code blocks enclosed in curly brackets


B, C, D.

Note

Classes may not be static.

Data and methods may be static, and often they are.

When the static keyword is followed by a code block, the block is a static initializer and is executed when the class is loaded.




PreviousNext

Related