In Java, methods are always associated with classes, and there’s no distinction between value and pointer receiver types as in some other languages. All non-primitive variables in Java are references to objects.
Java uses object-oriented programming paradigms, where methods are typically instance methods (like area() and perimeter() in this example) that operate on the object’s state. Static methods can also be defined, but they don’t have access to instance variables unless an object is passed to them.
Next, we’ll look at Java’s mechanism for defining abstract types and behaviors: interfaces.