一、类只有以下两个修饰:
public:随便调用
default:(缺省)同包内调用
变量与方法才有以下四个修饰
public:项目内引用即可调用
protected:不同包里引用,只能在子类中才能调用
default:(缺省)不同包不能调用
private:私有后只能本类调用。
二、基本数据类与其对应的封装类能通过java5版本的拆装机制互换使用:
public class Box{
public static void main(String[] args){
Integer a = new Integer(3);
Integer b = 3;
int c = 3;
c == b && c==a //true 比较的是值
b==a //false 比较的是地址
}
}
public:随便调用
default:(缺省)同包内调用
变量与方法才有以下四个修饰
public:项目内引用即可调用
protected:不同包里引用,只能在子类中才能调用
default:(缺省)不同包不能调用
private:私有后只能本类调用。
二、基本数据类与其对应的封装类能通过java5版本的拆装机制互换使用:
public class Box{
public static void main(String[] args){
Integer a = new Integer(3);
Integer b = 3;
int c = 3;
c == b && c==a //true 比较的是值
b==a //false 比较的是地址
}
}