下面的程序片断获取命令行参数并判断其值,第一个判断保证如果没有参数输入,则输出全部的项目,如果有参数,则由后面的if语句根据判断进行输出。
public static void main(string argv[]) {
string test = "all";
if (argv.length > 0) {
test = argv[0];
}
if (test.equals("all") || test.equals("tostreamresult")) {
system.out.println("/n/n==== tostreamresult ====");
try {
exampletostreamresult();
} catch (xpathexception ex) {
handleexception(ex);
}
}
…………
}
闽公网安备 35060202000074号