Static methods



Static methods neither require an instance of the class nor can they implicitly access the data (or this, self, Me, etc.) of such an instance. A static method is distinguished in some programming languages with the static keyword placed somewhere in the method’s signature.

In statically typed languages such as Java, static methods are called “static” because they are resolved statically (i.e. at compile time) based on the class they are called on and not dynamically as in the case with instance methods which are resolved polymorphically based on the runtime type of the object. Therefore, static methods cannot be overridden.


Class MyClass {
static float areaCirc (radio){
  //do some math here
  return area;


public class Mechanics {

    // add an instance variable for the object ID    
    private int cadence;
    private int gear;
    private int speed;

    //static method
    public static double speedURM (int dist, float time){
     // do some math here
    return urmSpeed;

Leave a Reply

Your email address will not be published. Required fields are marked *