aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static final variable initialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "static final variable initialization" Watch "static final variable initialization" New topic
Author

static final variable initialization

Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809


Above code compiles fine giving output 0 at runtime.

Why above code is not giving compilation error at line 4. i is not initialized upto that point. i is initialized at line 5.
----------------------------------------------------------

Can anyone find the problem in this code.




Regards


Naseem


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
For your second question see this topic I posted a week or so ago in Java In General (Intermediate)


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: static final variable initialization
 
Similar Threads
final Keyword in type conversion?
pls some1 clarify this
TOTALLY CONFUSED.......PLEASE HELP
What counts as "illegal forward reference"?
New java questions