Link to home
Start Free TrialLog in
Avatar of travishaberman
travishaberman

asked on

Do I need to import a class if it is in the project of the class I need it for?

I have 3 files in my project.  

1) main.java
2) Morg.java
3) Pod.java

I need the Pod.java file to use some of the functionality of the Morg.java file.  Do I need to import it?  I have tried to import it but I am not sure of the proper syntax to use.  And I my Pod file does not seem to acknowledge that the functionality of the Morg.java file.  

Thank you Experts,

-TH
Avatar of travishaberman
travishaberman

ASKER

OK.. I think I have a part of this figured out...  The I am trying to preform an operation on an object in a Vector container.  However, the container is initially given no objects so it does not know the type of the objects it contains.  The end result is that is that the compiler does not know what type of object I am trying to access so it tells me that it cant find the method .  So, I think I can fix this if I can tell the compiler that the object is of type "Morg".  That is, I need to tell the compiler that I am initializing a Vector of Morg objects.  Does anyone know how to do that?

-TH
ASKER CERTIFIED SOLUTION
Avatar of cyberdevil67
cyberdevil67

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A split seems fair enough. I would however, for future users, like to point out that with my comment about accessing a method like so:

   Morg.method();

The method() must also be static! (And in many cases, have an Access Control level of "public").