回顾方法及加深
- 方法的定义
- 修饰符
- 返回类型
- break:跳出switch,结束循环 和 return 的区别
- 方法名:注意规范 见名知意
- 参数列表: (参数类型, 参数名) …
- 异常抛出
- 方法的调用:递归
- 静态方法
- 非静态方法
- 形参和实参
- 值传递和引用传递
- this关键字
package com.oop;
import java.io.IOException;
//Demo01 类
public class Demo01 {
//main方法
public static void main(String[] args) {
}
/*
修饰符 返回值类型 方法名(...){
//方法体
return 返回值;
}
*/
public String seyHello(){
return "hello,world";
}
public void print(){
return;
}
public int max(int a ,int b){
return a>b ? a:b; //三元运算符!
}
//数组下标越界: Arrayindexoutofbounds
public void readFile(String file) throws IOException{
}
}