Invoking uninitialized variables in constructors
<p>In the constructor below, I have initialized only two of the variables, leaving some variables uninitialized explicitly.</p>

<p>As i have read, no argument constructor is created by the compiler if the constructor is provided by us.Then in such cases, since I have my own constructor so there is no default constructor which initializes variables p and q.</p>

<p>So, the logic should be if we try to access those uninitialized variables, then it should be a compile time error.However, the following code runs successfully. </p>

<p>The output is 
5
10
0.0
0.0</p>

<p>How can we explain the output 0.0 and 0.0 since i have not declared them in the constructor ?? </p>

<pre><code>public class Rectangle {
int l, b;
double p, q;

public Rectangle(int x, int y) {
l = x;
b = y;
}

public static void main(String[] args) {
    Rectangle obj1= new Rectangle(5,10);
    System.out.println(obj1.l);
    System.out.println(obj1.b);
    System.out.println(obj1.p);
    System.out.println(obj1.q); 
}
</code></pre>

<p>}</p>
