In Java, methods are always associated with classes. There’s no distinction between value and pointer receivers as in some other languages. All non-primitive variables in Java are references to objects.
Java uses object-oriented programming principles, where methods are defined within classes and operate on the object’s state. This is similar to the concept of methods in other languages, but with its own specific syntax and rules.
Next, we’ll look at Java’s mechanism for defining contracts for classes: interfaces.