Confusion regarding variables in Java

Do I know about designers and what they do?

Suppose there is a class:

class Kc
{
 int a=989;
 Kc(int a)
 {
     this.a=a;
 }
 public static void main(String []args)
 {

     Kc obj = new Kc(90);
     System.out.println(obj.a);
 }
}

The output of this program is 90. My question is:

Why are we allowed to use the string

 int a = 989;

An output of 90 means that it must be executed before the constructor is executed, so does this mean that we assign the value to an object variable that has not yet been created? Am I really confused?

+4
source share

All Articles