aspose file tools*
The moose likes Beginning Java and the fly likes doesn't compile my code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "doesn Watch "doesn New topic
Author

doesn't compile my code

srikanth sri
Greenhorn

Joined: Feb 21, 2010
Posts: 20
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

Joined: Feb 10, 2009
Posts: 710
You need to import the CheckingAccount class into your encapsulation class.


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 193

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.


SCJP 5, SCWCD 5
srikanth sri
Greenhorn

Joined: Feb 21, 2010
Posts: 20
These both are in the same package and more over they are declared as public.

so i think it should compile
srikanth sri
Greenhorn

Joined: Feb 21, 2010
Posts: 20
but i can compile CheckingAccount.java this without any error
Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 193

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

Joined: Feb 21, 2010
Posts: 20
i dont know what magic happened it got compiled right now.

anyways thank you very much.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: doesn't compile my code