Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Java in General
Illegal forward reference
Shardul Kumar
Greenhorn
Posts: 12
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
class Test { static { x = 2; System.out.println (x); // illegal forward reference } public static void main (String [] args) { System.out.println (x); // no problem here } static int x; }
Whats exactly happens here? Why am I getting an error while printing the value of x in the static block?
prem pillai
Ranch Hand
Posts: 87
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
http://radio.javaranch.com/corey/2004/05/13/1084483439000.html
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Explain the output
Initialization
Instance blocks.
question regarding initialzer.
Static Block
More...