File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes package / class name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "package / class name " Watch "package / class name " New topic
Author

package / class name

Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 339
In my book they say that its illegal tho have the same package and class name ???
I just tried it, and it compiled and worked fine !
Why this statement in my book ???
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Which version of the JDK / which compiler are you using? I remember for a while this rule wasn't enforced, but I think it is now by newer compilers/jdks....
Blanka Li
Greenhorn

Joined: Feb 18, 2002
Posts: 13
what book of yours?
I try it, and it works well.
here is the test code:
package Test;
public class Test
{
public static void main(String[] args)
{
System.out.println("Test OK!");
}
}
on jdk1.4.
Frank Jacobsen
Ranch Hand

Joined: May 17, 2002
Posts: 339
I use jdk 1.2 and it works also here !!!
I use the book "Complete Java 2 Certification study guide" from Simon Roberts Phillip Heller and Michael Ernest !
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: package / class name
 
Similar Threads
Compiling and Importing Non-Static Inner Class
where download the com.bea.jvm.event jar file.
class not found
servlet action
need help understanding access control