File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ public class Driver {
2
+
3
+ public static void main (String [] args ) {
4
+ System .out .println (greeting ());
5
+ System .out .println (greeting ("Jeremy" ));
6
+ if (greeting ("Hannah" , 12 )) {
7
+ System .out .println (", please show me your parents permission slip." );
8
+ }
9
+ }
10
+
11
+ public static String greeting () {
12
+ return "Hello, and welcome to my app." ;
13
+ }
14
+
15
+ public static String greeting (String name ) {
16
+ return "Hello " + name + ", welcome to my app." ;
17
+ }
18
+
19
+ /*
20
+ This one has the same signiture as the method above and thus cannot be used.
21
+ signiture = method name & parameter amount and type.
22
+ public static void greeting(String fullName) {
23
+ System.out.println("Hello " + name + ", welcome to my app.");
24
+ }
25
+ */
26
+
27
+ public static boolean greeting (String name , int age ) {
28
+ System .out .print ("Hello " + name );
29
+
30
+ // Are they under 18
31
+ if (0 < age && age < 18 ) {
32
+ return true ;
33
+ } else {
34
+ return false ;
35
+ }
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments