aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Access modifier doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Access modifier doubt" Watch "Access modifier doubt" New topic
Author

Access modifier doubt

Prashanth Patha
Ranch Hand

Joined: May 06, 2011
Posts: 62

I created one source file named 'Beverage.java' as follows :

// Beverage.java

class Beverage // default access and is in the current working directory(package)
{

}

It compiled fine.

But ,

// Tea.java

class Tea extends Beverage // also default access and is in the current working directory(package)
{
}

When this Tea.java file is compiled , it is giving an error that " Cannot find class Beverage " . Why it is so , even they are in same package(current default package).


Thanks & Regards
Prashanth

Achilleas Achix
Ranch Hand

Joined: Apr 18, 2011
Posts: 123

two quick ones:

1) your classes DO NOT BELONG TO ANY PACKAGE, there is no "package" designation in your sources
2) they should compile ok. check CLASSPATH env variable, if not set or not there, ensure it contains the "." directory.


OCPJP 6.0
Prashanth Patha
Ranch Hand

Joined: May 06, 2011
Posts: 62

Achilleas Achix wrote:two quick ones:

1) your classes DO NOT BELONG TO ANY PACKAGE, there is no "package" designation in your sources
2) they should compile ok. check CLASSPATH env variable, if not set or not there, ensure it contains the "." directory.

Thank you.....

I got it resolved by ensuring CLASSPATH include "." directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Access modifier doubt