Relatable r1 = new Length(12);
Relatable r2 = new Length(32);
System.out.println("r1.isLargerThan(r2) = " + r1.isLargerThan(r2));
we can call a method only with class object.is this right
Yes...
Call instance methods with instance variable:
Rectangle rect = new Rectangle(25, 25);
int w = rect.getWidth();
Call static (class) methods with ClassName:
double distance = Point2D.distance(x1, y1, x2, y2);