我收到一条错误消息,说无法从 Vehicle 类型中对非静态方法 GetNUMber() 进行静态引用。我不太明白发生了什么。请帮忙!
public class Vehicle
{
private int VehicleNumber;
public void SetNumber (int N){
VehicleNumber = N;
}
public int GetNumber (){
return VehicleNumber;
}
public static void main (String args[]){
Vehicle Maxda = new Vehicle();
Maxda.SetNumber(23423);
System.out.println("Vehicle Maxda number is " + GetNumber());
}
}