class R2
{
	final int t;
	void doit(){
		t=7;
	}
}

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 ?

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, networking, learning, and sharing knowledge.