class WhoSayWhat { public static void main(String args[]) { if(args.length<2) { System.out.println("请向应用程序传递两个参数"); System.exit(0); } String s=args[0]; String s2=args[1]; System.out.println(s+"say:"+s2); } }
运行:
运用指令传递参数:
Powered By PJBlog3 v3.1.6.227 CopyRight 2005 - 2008, Java伴侣 xhtml | css
Processed in 0.187500 second(s) , 6 queries , smixtrue Design By zKing