my dog learned polymorphism*
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "regarding final" Watch "regarding final" New topic
Author

regarding final

RatnaSekhar Kamireddy
Greenhorn

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€.

Yours,
Bu.


all events occur in real time
RatnaSekhar Kamireddy
Greenhorn

Joined: Aug 28, 2006
Posts: 3
Thanks i got it
 
jQuery in Action, 2nd edition
 
subject: regarding final