Making instance variable static
<p>I met such a Java problem about making instance variables static:</p>

<pre><code>public class Student {
 private static String name;

 public Student(String name) {
    this.name = name;
 }

 public String getName() {
  return name;
 }  
}
</code></pre>

<p>and test:</p>

<pre><code>public void testBadStatic() {
  Student studentA = new Student("a");
  assertEquals("a", studentA.getName());
  Student studentB = new Student("b");
  assertEquals("b", studentB.getName());
  assertEquals("a", studentA.getName());
</code></pre>

<p>I think the second assertEquals will fail, since the name variable is static, so it already been assigned "a". However, the correct output should be true for the second assertion and false for the last assertion. Could anybody help me understand this? </p>

<p>Thanks.</p>
