I want to call default constructor from a parameterized constructor inside a public java class.
Can I achieve it?
yes you can
public YourClass() {
public YourClass() { super();}
public YourClass(int x) { this();}
}
provided you have the same argument constructor. This won't work
public YourClass() {
public YourClass(int x, int y) { this(); } // compiler error here
public YourClass(int x) { super(); }
}
Note: super() calls the super constructor (in this case, class Object, because MyClass extends Object implicitly and class Object has a no arg constructor) that matches the same number of arguments.
this() calls the constructor of the current class that matches the same number of arguments.