• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question from Enthuware

 
nav katoch
Ranch Hand
Posts: 246
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runs fine here. What is the error you're getting?

Wouter Oet
 
nav katoch
Ranch Hand
Posts: 246
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 246
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Wouter. Its working now. I deleted the old file for K interface and then re-saved.

Naveen
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic