class A{
public double y=11.456789;
public void f(){
y=y+1;
System.out.printf("y是double型的变量,y=%f\n",y);
}
}
class B extends A{
int y=0;
public void g(){
y=y+100;
System.out.printf("y是int型的变量,y=%d\n",y);
}
}
public class Example5_3{
public static void main(String arg[]){
B b=new B();
b.y=200;
b.g();
b.f();
}
}
class A{
protected double x=8.0,y=0.888888;
public void speak(){
System.out.println("我喜欢NBA");
}
public void cry(){
y=x+y;
System.out.printf("y=%f\n",y);
}
}
class B extends A{
int y=100,z;
public void speak(){
z=2*y;
System.out.println("I love This Game");
System.out.printf("y=%d,z=%d",y,z);
}
}
public class Example5_4{
public static void main(String arg[]){
B b=new B();
b.cry();
b.speak();
}
}
class A{
public int f(int x,int y){
return x+y;
}
}
class B extends A{
public int f(byte x,int y){
return x*y;
}
}
public class Example5_5{
public static void main(String arg[]){
int z=0;
B b=new B();
z=b.f(10,10);
System.out.println(z);
z=b.f((byte)10,10);
System.out.println(z);
}
}