Search the Whole World Here.,.,

Calling Methods

 A sample of how to call methods in the same class.


/* CallingMethodsInSameClass.java
 *
 * illustrates how to call static methods a class
 * from a method in the same class
 */

public class CallingMethodsInSameClass
{
 public static void main(String[] args) {
  printOne();
  printOne();
  printTwo();
 }

 public static void printOne() {
  System.out.println("Hello World");
 }

 public static void printTwo() {
  printOne();
  printOne();
 }
}





Source : https://www.cs.utexas.edu/~scottm/cs307/javacode/codeSamples/CallingMethodsInSameClass.java


EmoticonEmoticon