0
我有一個類具有專用靜態變量,誤差的私有靜態變量
private static counter = 0;
但它給出了一個錯誤,當我編譯:
Car.java:3:<標識符>預計
private static counter = 0;
^
有沒有人知道它爲什麼這樣做?我不明白它有什麼問題。
這裏是整個代碼:
public class Car
{
private static counter = 0;
private String name;
public Car()
{
name = "car" +counter;
counter++;
}
}
是啊,我想通了,我張貼後..大腦放屁 – user939287