class Car
{
int num;
String color;
void run()
{
System.out.println(num+"..."+color);
}
}
class CarDemo
{
public static void main (String[] args)
{
Cnew Car().num = 9;
new Car().color ="orange";
new Car().run();
}
}
请问这样创建的匿名对象,为什么输出结果为0...null?
谢谢指点! |
|