小弟刚刚学java,javac CatTestClassQ4。java的时候,老是说CatTestClassQ4.java:24: 无法将 Cat 中的 meow() 应用于 (int)
kittyTwo.meow(m); 大虾们帮帮忙,还有小弟乃初学者,解释的时候尽量白话一点-_-"
public class CatQ4 {
String name;
String colour;
int age;
public void meow( ){
System.out.println("meooooow");
}
public void meow(int m){
if (( m <= 9) && (m>0)) {
for( ; m>0 ; m--){
System.out.print("meooow! ");
}
}
else
System.out.print("Error!");
}
}
public class CatTestClassQ4{
public static void main(String[] args){
Cat kittyOne = new Cat();
kittyOne.name = "Tiger";
kittyOne.colour = "Orange and Black";
kittyOne.age = 5;
kittyOne.meow( );
int m = Integer.parseInt(args[0]);
Cat kittyTwo = new Cat();
kittyTwo.name = "Snowball";
kittyTwo.colour = "White";
kittyTwo.age = 2;
kittyTwo.meow(m);
}
}
[此贴子已经被作者于2007-3-16 23:26:40编辑过]