
return 方法返回

抛出异常 try catch finally
// 文件名 : ExcepTest.java
import java.io.*;
public class ExcepTest{
public static void main(String args[]){
try{
int a[] = new int[2];
System.out.println("Access element three :" + a[3]);
}catch(ArrayIndexOutOfBoundsException e){
System.out.println("Exception thrown :" + e);
}
System.out.println("Out of the block");
}
}

静态方法:类.方法
非静态方法:对象.方法
OOP三大特性:
封装
继承
多态
构造函数:

new 创建对象 构造函数
默认无参函数可以不写,有参构造必须写无参
alt+insert=>创建构造函数

栈:变量值类型,引用
堆:具体内容
高内聚 : 高内聚就是数据操作自己完成,不允许外部干涉
低耦合:少量方法外部使用
属性私有


被折叠的 条评论
为什么被折叠?



