• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package / class name

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic