public class Demo01Method{
static int x = 120;
public static void main(String[] args) {
//方法的调用
int i = getSum(10,20);
System.out.println(i);
System.out.println(x);
System.out.println(getSum(100,20));
}
//求两个整数的和
public static int getSum(int a,int b) {
int sum = a+b;
System.out.println(x+"===============");
return sum;
}
} |
|