方法
定义
public static void 方法名称(){语句块}
方法的定义是无序性的
不能嵌套定义方法
命名方法
小驼峰式法
方法调用
格式
方法名称();
1 2 3 4 5 6 7 8 9 10 11 12 13
| public class test009 { public static void main(String[] args) {
System.out.println(intAdd(10,20));//方法调用 } //方法定义 public static int intAdd(int a,int b) { return a + b; } }
|