Java OCA OCP Practice Question 1452

Question

What technique allows multiple variables from the same class to be shared across all instances of a class?

  • A. Encapsulation
  • B. Immutability
  • C. Singleton
  • D. Static


D.

Note

The static keyword is used to create a class-level variable, making Option D correct.

A singleton is where you limit a class so only one instance can be created.

There are not multiple instances to share a variable across.




PreviousNext

Related