我用IntelliJ IDEA赋值,执行时没有输出?
帮忙看一下,为啥输出没有age那些赋值的参数。
public class IniTest1 {
public static void main(String[] args) {
Test1 test1=new Test1();
test1.age=120;
test1.height=199f;
test1.name ="Allen";
test1.eat();
test1.talk();
}
}public class Test1 {
String name;
int age;
float height;
void talk(){
System.out.println("You can talk to others");
}
void eat(){
System.out.println("You can eat what you want to ");
}
}只输出了以下内容
You can eat what you want to
You can talk to others
Process finished with exit code 0