|
@@ -1,23 +1,25 @@
|
1
|
|
-/* CallingMethodsInSameClass.java
|
2
|
|
- *
|
3
|
|
- * illustrates how to call static methods a class
|
4
|
|
- * from a method in the same class
|
5
|
|
- */
|
6
|
|
-
|
7
|
|
-public class CallingMethodsInSameClass
|
8
|
|
-{
|
9
|
|
- public static void main(String[] args) {
|
10
|
|
- printOne();
|
11
|
|
- printOne();
|
12
|
|
- printTwo();
|
13
|
|
- }
|
14
|
|
-
|
15
|
|
- public static void printOne() {
|
16
|
|
- System.out.println("Hello World");
|
17
|
|
- }
|
18
|
|
-
|
19
|
|
- public static void printTwo() {
|
20
|
|
- printOne();
|
21
|
|
- printOne();
|
22
|
|
- }
|
|
1
|
+/* CallingMethodsInSameClass.java
|
|
2
|
+ *
|
|
3
|
+ * illustrates how to call static methods a class
|
|
4
|
+ * from a method in the same class
|
|
5
|
+ */
|
|
6
|
+
|
|
7
|
+public class CallingMethodsInSameClass
|
|
8
|
+{
|
|
9
|
+ public static void main(String[] args) {
|
|
10
|
+
|
|
11
|
+ // Don't choose this one either. :-)
|
|
12
|
+ printOne();
|
|
13
|
+ printOne();
|
|
14
|
+ printTwo();
|
|
15
|
+ }
|
|
16
|
+
|
|
17
|
+ public static void printOne() {
|
|
18
|
+ System.out.println("Hello World");
|
|
19
|
+ }
|
|
20
|
+
|
|
21
|
+ public static void printTwo() {
|
|
22
|
+ printOne();
|
|
23
|
+ printOne();
|
|
24
|
+ }
|
23
|
25
|
}
|