public class horse{
public void darkhorse(String color ,float speed){
System.out.println("I an " +color );
System.out.println("My speed is " +speed);
int lon=1000;
float hour;
hour=lon/speed;
System.out.println("I run 1000 meters "+hour );
System.out.println("we are sheeping 10 hours.");
System.out.println();
}
public void brownhorse(String color ,float speed){
System.out.println("I an " +color);
System.out.println("My speed is " +speed);
int lon=1000;
float hour;
hour=lon/speed;
System.out.println("I run 1000 meters "+hour );
System.out.println("we are sheeping 10 hours.");
}
class whirehorse extends horse{
}
public static void main(String[] args) {
// TODO Auto-generated method stub
horse p1 = new horse();
p1.darkhorse("darkhorse", 30);
horse p2 = new horse();
p2.brownhorse("brownhorse", 40);
whirehorse p3= new whirehorse();
p3.brownhorse("whirehorse",50);
}
}
怎么不能调用brownhorse();?
帮下忙啊,谢谢。
public void darkhorse(String color ,float speed){
System.out.println("I an " +color );
System.out.println("My speed is " +speed);
int lon=1000;
float hour;
hour=lon/speed;
System.out.println("I run 1000 meters "+hour );
System.out.println("we are sheeping 10 hours.");
System.out.println();
}
public void brownhorse(String color ,float speed){
System.out.println("I an " +color);
System.out.println("My speed is " +speed);
int lon=1000;
float hour;
hour=lon/speed;
System.out.println("I run 1000 meters "+hour );
System.out.println("we are sheeping 10 hours.");
}
class whirehorse extends horse{
}
public static void main(String[] args) {
// TODO Auto-generated method stub
horse p1 = new horse();
p1.darkhorse("darkhorse", 30);
horse p2 = new horse();
p2.brownhorse("brownhorse", 40);
whirehorse p3= new whirehorse();
p3.brownhorse("whirehorse",50);
}
}
怎么不能调用brownhorse();?
帮下忙啊,谢谢。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货