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 Question from Enthuware 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 "Question from Enthuware" Watch "Question from Enthuware" New topic
Author

Question from Enthuware

nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246



Answer is It will print j = 3, jj=4 and then 3.

But, I am getting one error from this line #15 of code System.out.println(K.j);

Please explain.

Naveen
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Runs fine here. What is the error you're getting?

Wouter Oet


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

The error is " C:\SCJP6>javac Test.java
Test.java:3: cannot find symbol
symbol : variable K
location: class Test
public static void main(String[] args) { System.out.println(K.j); }
^
1 error

Thanks,
Naveen ^
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

The class (interface) K cannot be found.
Do you have all the code in 1 file or separate files?
Check if all the files are in the same dir.

Wouter Oet
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

Thanks Wouter. Its working now. I deleted the old file for K interface and then re-saved.

Naveen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question from Enthuware
 
Similar Threads
Interface Q
interface initialization
Hurting My Brains
Interface question
Initialization Related Prob