To compile the above example, you must be outside the packagetest directory. To compile the classes:
javac packagetest/ClassB.javaTo run the
javac packagetest/ClassA.java
main program in ClassA. java packagetest.ClassAor
java packagetest/ClassA
In windows the "/" can be replaced by the "\" in the javac command, but not in the java command. Generally use a forward slash ("/") because it is used more commonly than the backslash in other places as well.
No comments:
Post a Comment