If you have a package with two classes and one class wants to use the other class do you have to import the package even though they are in the same package?
is there any kind of declaration you have to do so that classes in the same package can "see" each other, because I can not compile my class because it can't find my other classes. I have checked the classpath.
Let me guess. The next thing you guys will ask is "Can you post the code" so here it is
and here is the error messages
[ March 30, 2008: Message edited by: colton peterson ]
A package consists of a number of compilation units (�7.3). A compilation unit automatically has access to all types declared in its package and also automatically imports all of the public types declared in the predefined package java.lang.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Originally posted by colton peterson: ... I have checked the classpath...
What is your classpath set to? Which directory are you compiling from?
ShapeIcon and SyncPoint are both declared to be in the package com.googlepages.kpcode.LynxVsRabbit, right? [ March 30, 2008: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
In Java, classes are identified by their qualified names. Because ShapeIcon is in the package com.googlepages.kpcode.LynxVsRabbit, its qualified name is com.googlepages.kpcode.LynxVsRabbit.ShapeIcon, and this is found in the directory C:\Documents and Settings\Kolten\Desktop\lynx vs rabbits\class. Use that as your classpath, and it should work.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Remember to always leap before you look. But always take the time to smell the tiny ads: