多态
package Jicheng;
import java.util.Scanner;
public class A {
public void test1(){
double y;
Scanner scanner = new Scanner(System.in);
System.out.println("输入t的值:");
double t= scanner.nextDouble();
y=Math.pow(t,2)+Math.pow(t,3);
System.out.println(y);
scanner.close();
}
}
package Jicheng;
public class B extends A {
public void test1(){
System.out.println("panpan");
}
public void eat(){
System.out.println("小马");
}
}
package Jicheng;
public class Applicatiom {
public static void main(String[] args) {
B b = new B();
A a = new B();
b.test1();
a.test1();
}
}