compile with
javac -classpath . <Classname>.java
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
I've copied your code and it works perfectly. How do you have your files organized?
Like this?
-WorkerDirectory
+ Worker.java
+ HourlyWorker.java
+ SalariedWorker.java
+ WorkerTester.java
Some package definitions lacking maybe?
Black Box
Black Box
Junior Poster in Training
62 posts since Nov 2007
Reputation Points: 60
Solved Threads: 7
Show your exact directory structure, and the exact command you used to compile.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
hi from my understanding there is no default constructor defined in any of the Classes that you wrote.when you are overloading constructor the default constructor is not provided. externally you have to write the default constructor
tell me i am wrong.
This has nothing to do with a default constructor. And, you neverhave to implement a default constructor. Only if you want to.
Edit: Well, I shouldn't really say never, but at least the cases where you might have to are not that common, and definately not a problem in this case.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
The WorkerTester.java file as well as all the other files associated with it is located in the directory, so I don't think I have to specify the classpath as a parameter.
"." is not necessarily on the classpath, and if it is not, then yes, you do have to add it. So did you actually try with the command I showed you? Or did you just assume that it wouldn't make a difference? Also, try to compile one of the classes that does not depend on any of the others, and then make sure that the classfile actually appears in the same directory as the java file (not that you have some alias set that automatically causes the compiler to place the class files elsewhere). If it is there, then compile them one at a time from the file with the least dependencies, to the file with the most. More than bit annoying, but hey.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494