Question using inheritance with packages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gil

    Question using inheritance with packages

    Hi,

    I have 2 classes in a package. One class inherits from the other. I
    had no problems compiling the classes when the classes weren't in a
    package, but as soon as I put the classes in a package and appropriate
    directories, I get the error :

    cannot resolve symbol
    symbol : class Base

    My code, each class is in a different file in the same directory :

    in directory first\second :

    Base.java :

    package first.second;

    public class Base {
    };

    A.java :

    package first.second;

    public class A extends Base {

    };

    Can anyone see what I'm doing wrong?

    Thanks,

    Gil
  • Doyle

    #2
    Re: Question using inheritance with packages

    > I have 2 classes in a package. One class inherits from the other. I[color=blue]
    > had no problems compiling the classes when the classes weren't in a
    > package, but as soon as I put the classes in a package and appropriate
    > directories, I get the error :
    >
    > cannot resolve symbol
    > symbol : class Base
    >[/color]
    Check your classpath to make sure that the package directory is in the
    path in the right place i.e. if you have a package foo with a class
    bar in your directory structure c:\java\foo then c:\java has to be in
    your classpath. Java will take care of the rest.

    mypetrock

    Comment

    Working...