Loading

Q1.

What is the purpose of the final keyword in Java?

A. To define a constant or prevent modification

B. To make a variable accessible globally

C. To create abstract classes

D. To define static variables

Q2.

 Which of the following statements is TRUE about final variables?

A. A final variable can be reassigned after initialization

B. A final variable must be initialized only once

C. A final variable is always static

D. A final variable can change value during runtime

Q3.

What will happen if you try to extend a final class?

A. It will compile successfully

B. It will throw a runtime exception

C. It will cause a compilation error

D. It will create an abstract class

Q4.

What happens when a method is declared final?

A. It can be overloaded but not overridden

B. It can be overridden but not overloaded

C. It cannot be called by subclasses

D. It cannot be inherited

Q5.

Which of the following is NOT true about final?

A. A final class cannot be extended

B. A final variable cannot change its value

C. A final method cannot be overridden

D. A final variable can be declared without initialization and changed later