From http://zhidao.baidu.com/question/170311786.html
Using Ultra Edit to program a package is the same as writing a package without a package. There is only one difference in Compilation: Package com. util; public class myjava {}. If there is a package program: javac-D. myjava. JavaCurrentDirectory to generate a com folder, which contains an util folder, which contains a myjava. class File Execution command: Java COM/util/myjava if there is no public class myjava package {} is javac myjava. java executes Java myjava
Understanding: package is used to specify the folder name. For example, Com. util has a folder named com, and COM has another folder named util. Util is the specific package (folder) where the class myjava is located ). When creating a folder, use the javac-D Class Name. Java to compile the folder.
If you want to generate a class file in another directory instead of the current directory, you can add a path after javac. For example, javac-d F:/javaproject myjava. Java generates the com folder, util folder, and myjava. Class file under the F:/javaproject directory.