- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtutorial_27.java
More file actions
Latest commit
27 lines (25 loc) · 824 Bytes
/
Copy pathtutorial_27.java
File metadata and controls
27 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
classDriver {
//
publicstaticvoidmain(String[] args) {
System.out.println( greeting() );
System.out.println( greeting("Jeremy") );
System.out.println( greeting("Jeremy", "England") );
}
//
staticStringgreeting() {
returngreeting("Person", "");
}
//
staticStringgreeting(Stringf) {
returngreeting(f, "");
}
// added a ternary operator here as per request to get rid of the extra space when only putting a first name.
staticStringgreeting(Stringf, Stringl) {
return (
"--------------------------------\n" +
"Hello, " + f + (l.equals("") ? "": " ") + l + ". Welcome to my app.\n" +
"--------------------------------"
);
}
//
}