class R2
	final int t;
	void doit(){

Blank finals allow us to declare a final variable without explicitly initializing it. We can initialize it only once later. Then, why is th above code not working ?

Recommended Answers

All 3 Replies

A blank final var must be initialised in all constructors - ie it must have a value by the time the containing instance has been initialised.

Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.