Most of the early programming languages were Procedural Languages which means that the focus is on the sequence of instructions. The data was secondary to the methods, functions, and subroutines. Examples of these languages are C, FORTRAN, COBOL, and Pascal.
Object Oriented programming languages, such as C++ and Java, the focus is on the data. The data takes the form of objects. Objects have two primary features: properties and behavior.
The properties of an object, also called state, are values of the object. For example, if we have a object that represents a ball, some of its properties might be size, weight, colors, sport. These properties may be stored directly in an object or may be derived. Lets say that the properties of size and weight are stored as variables in the object. We could derive the property of density from the size and weight properties.
The behavior of an object are done through methods in the object which are called class methods. A method is what other programming languages would call a function or a subroutine. The basic difference between the names is that in object oriented programming a method exists within an object and a function or subroutine does not.
Note: A subroutine is basically a function that does not return a value.
In our example of ball object, some possible behaviors might be bounce(), throw(), catch(), and hold(). Calling any of these methods may change properties of the object, such properties as location and velocity. A class method can also change the properties of other objects if those objects are passed to the class method.
Java is a programming language that was designed to a strict object oriented programming language. By strict we mean that everything is an object.
There is a partial exception to this. There are primative data types that store values of integers, real numbers, boolean variables. This is a partial exception because these data types can only be defined inside of an object data type. An object data type is called a class.
Functions do not exist in Java because they cannot be defined outside of a class. Therefore, all functions are methods that are defined in the class data type.