You need to sign in to do that
Don't have an account?
IMU Admin
Apex Workbook
Hi,
I am working through the Apex Workbook for Spring 15.
I have followed each step but seem to get the below error message when executing the request:
Line: 1, Column: 19
Constructor not defined: [Fridge].<Constructor>(String, Integer)
I have the following code within the Class:
public class Fridge {
private String modelNumber;
private Integer numberInStock;
public void updateStock (integer justSold) {
numberInStock = numberInStock - justSold;
}
public void setModelNumber (String theModelNumber){
modelNumber = theModelNumber;
}
public String getModelNumber (){
return modelNumber;
}
public Fridge() {
modelNumber = 'XX-XX';
numberInStock = 0;
}
public Fridge(String theModelNumber, Integer theNumberInStock) {
ModelNumber = theModelNumber;
numberInStock = theNumberInStock;
}
Can anyone help me out please?
Thanks
Josh
I am working through the Apex Workbook for Spring 15.
I have followed each step but seem to get the below error message when executing the request:
Line: 1, Column: 19
Constructor not defined: [Fridge].<Constructor>(String, Integer)
I have the following code within the Class:
public class Fridge {
private String modelNumber;
private Integer numberInStock;
public void updateStock (integer justSold) {
numberInStock = numberInStock - justSold;
}
public void setModelNumber (String theModelNumber){
modelNumber = theModelNumber;
}
public String getModelNumber (){
return modelNumber;
}
public Fridge() {
modelNumber = 'XX-XX';
numberInStock = 0;
}
public Fridge(String theModelNumber, Integer theNumberInStock) {
ModelNumber = theModelNumber;
numberInStock = theNumberInStock;
}
Can anyone help me out please?
Thanks
Josh
Same is working for me. P Call From Developer Console:
All Answers
Closing '{' bracket is missing in class defination.
Please try below.
Let us know if it helps.
Apologies I have missed that off when copying the code over. The closing bracket is present within the code.
Thanks
Josh
Please mark it as solved so others can get help from it.
This has not solved the issue - the bracket was present in the code and always has been
Thanks
Josh
How you are calling this class ?
Its working for me .
Fridge myFridge = new Fridge('MX-EO', 100);
System.debug (myFridge.getModelNumber());
Same is working for me. P Call From Developer Console:
I have just re-written code as above but still getting the same error message. Am i correct calling the code from the Execture Anonymous window?
Seems strange we have the same code but are getting different outputs?
Thanks
Josh