Skip to content

Commit 53552a5

Browse files
authored
Create tutorial_26.java
1 parent 92aba1d commit 53552a5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

code/tutorial_26.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy