I am aware about the constructors 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 the above program comes out to be 90. My question is this?
Why are we allowed to use the line
int a = 989;
The output being 90 means it must have been executed before the constructor is executed so this means that we are assigning a value to an object's variable that has not yet been created? I am really confused?