You need to sign in to do that
Don't have an account?
Navneeth Raj
When Execute is clicked error comes as below
Line: 1, Column: 17
Constructor not defined: [ConsWithPara].<Constructor>()
What's the error Here? Constructor not defined: [ConsWithPara].<Constructor>()
When Execute is clicked error comes as below
Line: 1, Column: 17
Constructor not defined: [ConsWithPara].<Constructor>()
You are using parameterize constructor in your main class. And in developer console you are creating object like below
ConsWithPare obj = new ConsWithPare ();
Please try below code
Please let us know if this will help you.
Thanks
Amit Chaudhary
The error indicate you have not defined a default constructor in your class.
Here, in apex code where you are creating object for this class (line 1), you are using default constructor which is not defined in class. Only one parameterized constructor is defined. just add below line in your class to solve this problem:
Hope this helps you,
Regards,
Prashant
If you don't define any constructor in your class, then there is a default one with no arguments. However you have already defined one with an argument:
So, or you create another one without arguments, or you would need to use this one.
Your second line, would also fail, because you are trying to call the constructor after instansciate it. And the same with the 3rd, you are trying to call cal method with the name of the class. If the method where static, you would execute the 3rd like like you try but as they are not static, it should be with cp variable. In addition, your cal method is void, so you cannot assign it to a variable. Finally display call is the same, it shoudl be like this your call:
Hope this helps