Jan 02

Statics.java Demonstrates static and non-static methods.


public class Statics {
 public static void main(String[] args) {
    Statics s1 = new Statics();

  public static void staticMethod() {
    System.out.println("This is a static method.");

  public void regularMethod() {
    System.out.println("This is a regular method.");

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017

Skip to toolbar