error with a private static variable
<p>I have a class that has a private static variable,</p>

<pre><code>private static counter = 0;
</code></pre>

<p>but it gives an error when I compile it:</p>

<p>Car.java:3:  &lt;identifier>  expected</p>

<pre><code>private static counter = 0;
                      ^
</code></pre>

<p>Does anyone know why it does this?  I don't understand what's wrong with it.</p>

<p>Here's the whole code:</p>

<pre><code>public class Car
{
    private static counter = 0;
    private String name;

    public Car()
    {
    name = "car" +counter;
    counter++;
    }
}
</code></pre>
