package JAVASE.method; public class mt02 { public static void main(String[] args) { double m = m(1.2, 2.1); System.out.println(m); } public static double m(double a,double b){ double r = 0;//初始化 if (a==b){ System.out.println("a==b"); return 0;//终止方法 } if (a>b){ r=a; }else { r=b; } return r; } //比大小 public static int m(int a,int b){ int r = 0;//初始化 if (a==b){ System.out.println("a==b"); return 0;//终止方法 } if (a>b){ r=a; }else { r=b; } return r; } }
//例: public static void main(String[] arg){ //args.length 数组长度 for(int i = 0;i<args.length;i++){ System.out.println("args["+i+"]:"+args[i]); } }
2021.8.15