Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doesn't compile my code

 
srikanth sri
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody please help me out in compiling the program.Here i'm using the example for the encapsulation but doesn't work.

CheckingAccount.java




and i get compiler error like cannot find symbol :CheckingAccount

CheckingAccount myAccount = new CheckingAccount();

thanks in advance

 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to import the CheckingAccount class into your encapsulation class.
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 197
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srikanth,

That code works perfectly without any errors if you are using any editor like eclipse.
If you are not using any editor, you have to take care about the class path settings.
Since your class path is not correct it is not able to find CheckingAccount class. Hence the error.
 
srikanth sri
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These both are in the same package and more over they are declared as public.

so i think it should compile
 
srikanth sri
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i can compile CheckingAccount.java this without any error
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 197
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your current directory/package is not in class path. CheckingAccount does't need any other classes created by u. So it compiles.
 
srikanth sri
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont know what magic happened it got compiled right now.

anyways thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic