/*
方法
方法:C语言中的函数
格式:
修饰符 返回值 方法名 (参数类型 参数名1)
{
方法体语句;
return 返回值;
}
修饰符: public static
方法和C语言差不多,比C语言多了修饰符
*/
package study;
public class study_2{
public static void main (String[] args){
int x = 10;
int y = 20;
int z;
z = sum(x,y);
System.out.println(+z);
}
public static int sum (int a,int b){
int c;
c = a + b;
return c;
}
}