Monday, February 2, 2015

Java static vs instance method



Java static method vs instance method

 
class Difference 
{
 
  public static void main(String[] args) 
{
    display();  
    Difference t = new Difference();
    t.show();  
  }
 
  static void display() 
{
    System.out.println("Programming is amazing.");
  }
 
  void show()
{
    System.out.println("Java is awesome.");
  }
}

No comments:

Post a Comment