• Post Reply Bookmark Topic Watch Topic
  • New Topic

Yet another Package question...  RSS feed

 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the java tutorial on java.sun.com under Creating a Package I found this statement:

To create a package, you put a class or an interface in it. To do this, you put a package statement at the top of the source file in which the class or the interface is defined. For example, the following code appears in the source file Circle.java and puts the Circle class in the graphics package:


What this suggests (to me :roll: ) is that the way the hierarchy is created is by placing the statement at the top of the source file... Which is not right. The source file has allready been placed in the hierarchy; which is being pointed to by the statement - correct? The fact that it is in a particular folder strongly implies it is in that package. What need is there of the statement?
TIA
[ October 30, 2003: Message edited by: Donald R. Cossitt ]
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compiler ignores which folder the source file is in. The compiler will place the compiled classes in a class folder according to what is specified in the package statement. When a Class implements or extends another Class, that places it at the bottom of the hierarchy of whatever it extends or implements.
Angel
 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DOH! *.java v *.class
I don't know whether I have been reading too much or not enough!
Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!