When the constructor taking no argument is known as 0-arg constructor. Let’s see an example for better clarity.
ConstructoeExample1.java
class A { int x,y; A() //0-arg constructor { x=100; y=200; } void show() { System.out.println("x="+x); System.out.println("y="+y); } } class ConstructorExample1 { public static void main(String[] args) { A obj=new A(); obj.show(); } }
Output:
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc