The scope of the variable you declared inside the Main method is local and hence it remains relevant within that scope, outside that method you cannot use it and that is why the compiler will print the value of that variable declared in the class level.