This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes regarding final Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "regarding final" Watch "regarding final" New topic

regarding final

RatnaSekhar Kamireddy

Joined: Aug 28, 2006
Posts: 3
hi guys,
there is a line in scjp 5 text book(2 minutes drill)
"final reference variables must be initialized before the constructor completes"

whats the actual meaning of this
please explain this in detail
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643

In above code comment and uncomment line 4 and see result.
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Actually, the final variable has to be initialized before any constructor completes.
The following will not compile due to the sierra-line. If instantiated with a string as argument, variable i wouldn't get a value. 0€.


all events occur in real time
RatnaSekhar Kamireddy

Joined: Aug 28, 2006
Posts: 3
Thanks i got it
I agree. Here's the link:
subject: regarding final
It's not a secret anymore!