File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Initialisation steps Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Initialisation steps" Watch "Initialisation steps" New topic
Author

Initialisation steps

Ravi Prasad
Greenhorn

Joined: Aug 19, 2000
Posts: 3
hi
Can anyone explain why if Line1 is included the class fails to compile (correctly so) but does not complain for Line 2or Line3.
IS the initalisation routine follows the source code and should have given the forward refrence error for line 2 and line3


Thanks
Ravi
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Hi Ravi
I just compiled this program and it gives error saying
Cant make forward reference to i, j and l.
This is beacuse the static code is initialized first in the order in which it appears.so u cannot make a forward reference.

deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
Hi,
for me alsoThis program complains at line 1,2,3 for forward referencing. so Ravi can u check it again?
regards
deekasha
Ravi Prasad
Greenhorn

Joined: Aug 19, 2000
Posts: 3
Hi Deeksha and Sunita
IF you comment the line 1 then you will not get compile time error and the program will do a correct output. I am using jdk1.3. It's only when you uncomment line 1 you get forward refrencing error.
Ravi
 
 
subject: Initialisation steps
 
Threads others viewed
shift >>operators
Increment Test
continue statement
Marcus Exam 3 Qn# 54
Brute Force
IntelliJ Java IDE