java的多态有两种表现形式,重写(覆盖)和重载(类本身内的,和继承什么的都没关系)。
public abstract class anmial
{
String runString;
public void run(String howrun)
{
runString=howrun;
System.out.println("anmial run");
}
public void run()
{
}
void run(int a){
System.out.println("animal run");
}
double run(int a,int b){
return (double)a;
}
double run(int c,double a,int d){
return a;
}
double run(double c,int a,int d){
System.out.println("hhhhhhhhh");
return a;
}
public abstract void eat();
public static void main(String[] args)
{
anmial a=new cat();
a.run(2.0,8,9);
}
}
class cat extends anmial{
@Override
public void eat()
{
// TODO Auto-generated method stub
}
@Override
public void run()
{
// TODO Auto-generated method stub
//super.run(2,3.0,4);
System.out.println("cat run");
}
}