function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HERISH SURENDRSNHERISH SURENDRSN 

Lets consider there is a Class containing Parameterised contructor not the user defined Default constructor. Now on instantiating the class will the default constructor be called ?

Best Answer chosen by HERISH SURENDRSN
TechingCrewMattTechingCrewMatt
No, if you call an overloaded constuctor, only the constructor with the correct arguments will be called. You could call the default constructor from the overload constructor if you wanted to:
public class MyClass{
    public MyClass(){

    }

    public MyClass(Object obj){
        this();
    }
}
Or vice versa:
 
public class MyClass{
    public MyClass(){
        this(Systm.now());
    }

    public MyClass(Object obj){

    }
}

Thanks,
Matt