[英]A simple ques-tion but I don't know why?
public class Car2
{
int speed;
String color;
public static void main(String[]args)
{
Car carpassedby=new Car();
carpassedby.speed=60;
carpassedby.color="green";
}
}
The IDE tell me the lastest "speed " and "color " are error IDE 告诉我最新的“速度”和“颜色”是错误的
use Car2 carpassedby=new Car2();
使用
Car2 carpassedby=new Car2();
. . Your variables are in
Car2
but you are using Car
.您的变量在
Car2
但您使用的是Car
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.