How to Create a Class Method in Java


In this example, we will learn you how to create a class method in Java.

Source Code

package com.beginner.examples;

public class CreateMethod {
  static void test() { // create a class method
    System.out.println("ok");
  }

  public static void main(String[] args) {
    test();
  }
}

Output:

ok
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments