package com.ran.method;
public class Demo2 {
public static void main(String[] args) {
int name = name(60, 60);
System.out.println(name);
}
public static int name(int a, int b) {
int result = 0;//定义一个结果,然后把形参赋给result;
if (a==b){
System.out.println("a==b");
return 0;
}
if (a > b) {
result = a;
} else if (b > a) {
result = b;
}
return result;
}
}
"=================================================================
package com.ran.method;
public class Demo1 {
//main 方法
public static void main(String[] args) {
//实际参数 :实际调用传递给他的参数
int sum = add(1, 2);
System.out.println(sum);
// test();
}
//加法
// 形式参数,用来定义作用的
public static int add(int a ,int b){
return a+b;
}
public static void test(){
for (int i = 0; i <= 35; i++) {
for (int j = 35; j >= 0; j--) {
if (i * 2 + j * 4 == 94 && i + j == 35){
System.out.println("鸡:"+i+"兔:"+j);
}
}
}
}
}
"