This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Forward reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Forward reference" Watch "Forward reference" New topic
Author

Forward reference

Rastogi Manish
Greenhorn

Joined: Dec 11, 2006
Posts: 5
Can some body help me below code. It compile properly but it givec compile time error when I comment out SOP with reason illegal forward reference.



Thanks & Regards
Manish Rastogi
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

You are trying to use the variable a before it is declared. The forward referencing rule says that you cannot use a variable on the right hand side of an assignment statement or use it to print something before it can be declared.

Hope this helps.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Rastogi Manish
Greenhorn

Joined: Dec 11, 2006
Posts: 5
Ok Thanks Sankararaj

Regards,
Manish Rastogi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Forward reference
 
Similar Threads
Reference an instance variable before super constructor?
Java ambigious method calling doubt
static variables vs static initializers
try this program
Some funky code. Can someone explain?