java方法的定义格式
public class Main {
// 对于函数方法的使用
// 在函数方法中可以有含参方法和无参方法,不能进行嵌套定义。
// 方法的结构:
// public static 返回类型 函数名(参数类型 参数名称,。。。。)
// {
// return 参数;
// }
public static void main(String[] args) {
int c;
c=getmax(20,30);
System.out.println(c);
}
public static int getmax(int a,int b)//判断大小,取大数
{
return a>b?a:b;
}
}