I know this question has been asked many times but I still don't understand how the import statement works. I have a example of my problem as follows.
I have my main file for a simple game in the path: C:\myjavafiles\game.java, I have a file for creating Dwarves in a path called: C:\myjavafiles\dwarf.java, I also have a file for declaring job types in: C:\myjavafiles\support\jobTypes.java. My question is, how could I import dwarf.java and jobTypes.java into game.java if I have the code in each file as follows:
game.java:
// import dwarf.java and jobTypes.java here
class game {
public static void main(String args[]) {
// Do something
}
}
dwarf.java:
public class dwarf {
public dwarf() {
// setup dwarf
}
}
jobTypes.java:
public class jobTypes {
public jobTypes() {
// Do something
}
}
Thank you for you time.
EDIT:
I've add dwarf.java to the package support. And I've add this statement to game.java:
import support.*;
But that doesn't work.