Instance Methods
Instance methods operate in the context of a particular class instance (i.e. a particular object).
The instance variables of the current object can be accessed without any prefix:
public class Complex {
// Adds z to the current object
public void add(Complex z) {
real += z.real ;
imaginary += z.imaginary ;
}
public double real ;
public double imaginary ;
}