Can I make a class object treated as another data type? I want to make an class, that can be read as a boolean object, when the object is created in a main class. For example
public class ReturnValue {
String one = "text";
// some code that makes this class a boolean 'true'.
}
public class main {
public static void main(String[] args) {
returnValue object = new returnValue();
if object
System.out.println("the subclass is true."); //so that it could print out.
}
}