Package cn.imeixi.chapter1.exer; Public class Exer10printargs { publicstaticvoid main (string[] args) { for (int i = 0;i < args.length;i++) { System.out.println ("args[" + i + "] =" + args[i]);
} }}
First exer10printargs . Java to be placed in a subfolder.
For example exer10printargs . Java declaration belongs to package Cn.imeixi.chapter1.exer;
So you're going to put exer10printargs.java put it in a call cn/imeixi/chapter1/exer under the folder.
Compile, in the xxx folder previous src, then run
Javac ./cn/imeixi/chapter1/exer/exer10printargs.java "When compiling, Path with xxx/xxx/xxx "
。
Run the time, also on the xxx folder on a layer , and then run
Java cn.imeixi.chapter1.exer. Exer10printargs "When executing, package name with XXX.XXX.XXX"
SRC (home directory, all of your operations run here)
|
/cn/imeixi/chapter1/exer/ (sub-folder for all source files belonging to XXX package)
|
Exer10printargs. java
CMD run (packaged) Java program