Computer Science, asked by AbdulHafeezAhmed, 7 months ago

What is the usage of blank final variables in Java? ❌Spammers stay away❌

Answers

Answered by Anonymous
6

Answer:

In Java, a final variable can a be assigned only once. It can be assigned during declaration or at a later stage. A final variable if not assigned any value is treated as a blank final variable

Answered by Anonymous
12

In Java, a final variable can be assigned only once. It can be assigned during declaration or at a later stage. A final variable if not assigned any value is treated as a blank final variable. Following are the rules governing initialization of a blank final variable:-

*A blank instance level final variable cannot be left uninitialized.

*The blank Instance level final variable must be initialized in each constructor.

*The blank Instance level final variable cannot be initialized in class methods.

*A blank static final variable cannot be left uninitialized.

*The static final variable must be initialized in a static block.

*A static final variable cannot be initialized in constructor or class methods.

Hope it helps u bro.......☺️

Similar questions