java 的基本数据类型 primitive type
byte short int long
float double
char
boolean
继承和多态
关于继承
public class Fu {
public String name = "fu";
public void method()
{
System.out.println(name);
}
}
public class Zi extends Fu{
public String name="zi";
@Override
public void method() {
System.out.println(name);
}
public void methodZi()
{
System.out.println(name);
}
}
public static void main(String[] args) {
Fu f = new Fu();
Zi z = new Zi();
Fu fz = new Zi();
// 测试1 成员变量,谁调用,用谁的
System.out.println(f.name); // fu
System.out.println(z.name); // zi
System.out.println(fz.name); // fu
System.out.println("============================");
//测试2 重载方法 方法属于谁,调用谁
f.method(); // fu
z.method(); // zi
fz.method(); // zi
z.methodZi(); //zi
// 测试3 重载方法中调用父类的变量或者局部变量
// this super
}