Default Constructor2

in Hindi - Default Constructor2



not yet

Source Code :

RUN<div class="col-sm-12">
<div class="col-sm-6">
<h4>Without Default Constructor</h4>
<pre>
class Demo3{ 

void Demo(){
System.out.println("Without Default Constructor.");
}

public static void main(String args[]){ 

Demo3 d1=new Demo3(); 
d1.Demo();
} 
}

<h5>Output :</h5>
Without Default Constructor.</pre>
</div>
<div class="col-sm-6" style="margin-top:-18px">
<h4>With Default Constructor</h4>
<pre>
class Demo3{ 

Demo3(){
System.out.println("With Default Constructor.");
}

public static void main(String args[]){ 

Demo3 d1=new Demo3(); 
} 
}

<h5>Output :</h5>
With Default Constructor
</pre>
</div>
</div>