I'm, having a little problem understanding why I get this compiler error. This was just a way for me to understand how all reference type inherit from Object class, but I'm more lost than ever :(
import static java.lang.System.out;
public class InheritObject {
public static void main(String[] args) {
new InheritObject().program();
}
void program() {
MyOwnClass m = new MyOwnClass();
out.println(m.toString());
out.println(m.getClass()); // Get class used to create this object
out.println(m.equals("abc")); // m == "abc" not allowed, but equals is!
out.println(m=="abd"); // ... and default equals() uses == ?!
out.println(m.equals(5));
out.println(m.hashCode());
// Etc.
}
class MyOwnClass{
// No methods here!!!
}
}