Question: ```
class C3 {
    public static int n = 0;
    public int m = 0;

    public C3() {
        n++; 
        m++; 
    }

    public void display() {
        System.out.println(n + " " + m);}
    }
}

```

Execution of: - 

```
C3 c1 = new C3(); 
c1.display(); 
C3 c2 = new C3(); 
c1.display(); 
c2.display();   

```

Prints numbers (output) 

```
1 1 
2 1 
2 1

```

Can anyone please explain me the output step by step? i am a bit confused about the 2nd line of output, why didn't both m and n value increase? also in 3rd output why didn't it start from beginning?

Answer: 
`n` is a static variable, as a result its scope is the class, not the instance.

`m`, on the other hand, is an instance variable and only has an existence within an instance.

As a result, each time you initialize a `new C3()`, `m` is set to 1 (since it is a new `m`), but `n` gets incremented each time (since all instances share it).
```
class C3 {
public static int n = 0; //static or class variable, n does not become 0 after every new instance
public int m = 0; //instance variable, m becomes 0 for every instance

public C3() {
    n++; //n becomes the "last value the class had for n" + 1
    m++; //m becomes 1
}

public void display() {
    System.out.println(n + " " + m);}
}

```

}

Always look at a **static variable** as a **class variable**, so you will only instance it with 0 the **first time**.