In this example we will show the method to create and call a method in Java.
Source Code
package com.beginner.examples;
public class CreateAMethod {
static void test() {
System.out.println("ok");
}
public static void main(String[] args) {
test(); // call the method
}
}
Output:
ok