CallingMethodsInSameClass.java 417B

1234567891011121314151617181920212223
  1. /* CallingMethodsInSameClass.java
  2. *
  3. * illustrates how to call static methods a class
  4. * from a method in the same class
  5. */
  6. public class CallingMethodsInSameClass
  7. {
  8. public static void main(String[] args) {
  9. printOne();
  10. printOne();
  11. printTwo();
  12. }
  13. public static void printOne() {
  14. System.out.println("Hello World");
  15. }
  16. public static void printTwo() {
  17. printOne();
  18. printOne();
  19. }
  20. }