- A A static variable is a variable that is accessible only within the static methods of a class.
- B A static variable is a variable that is shared among all instances of a class and is not specific to any particular instance.
- C A static variable is a variable that is declared with the "static" keyword and cannot be changed once assigned a value.
- D A static variable is a variable that is declared inside a static block in a class.
- Share this MCQ
Answer:
C
Share this MCQ
A static variable in Java is a variable that is declared with the "static" keyword and cannot be changed once assigned a value. It is accessible from anywhere within the class, but not from outside the class. It is also shared among all instances of a class, meaning that any changes made to the static variable will be reflected in all instances of the class.
Click me to Read more Question & Answer of Java Interviews MCQsShare this MCQ