Suppose I have added the line package comklumpshapes at the
Suppose I have added the line
package com.klump.shapes;
at the top of a java file. If I am in the folder c:\\temp\\, and I compile the file Circle.java using the line
javac –d . Circle.java
in what folder will Circle.class be written?
Solution
We need to include the package statement as the first statement in the source file so as to make a class as part of a package.
Therefore, when we include the package statement \"package com.klump.shapes;\" as the top most statement of our java file Circle.java , then Circle.java now becomes part of this package.
While compiling a java source code, we need to use the -d option to specify the package base directory of the compiled class.
After compilation, Circle.class will be written in :
c:\\temp\\com\\klump\\shapes\\Circle.classes
