Here is my method
public String isOpen() {
if (fridge.isOpen()) {
return String("The refrigerator is open.");
}
}
and I get this error on the return line.
The method String(String) is undefined for the type Kitchen
I don't understand why String is undefined. Isn't it a universal part of java that doesn't care if you are inside a class called Kitchen?
String is not a method, is a class. So, if you want to return a String you have to use the constructor of the class String, or use the simpler way, just return text between "".
So, instead of
return String("The refrigerator is open.");
do
return "The refrigerator is open.";
Hope it helps :)