• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default and Subpackage

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
When I imported a class from a default package into a class in its sub package, I am getting a compile error.

I did this as import DefaultPackageClass;

Is this wrong?

Thanks,
Allen
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, it's wrong. It's expressly disallowed in the language specification, perhaps to discourage you from using the default package for anything but trivial student programs.

Early Java compilers did allow this, but more recent ones don't.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic