-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnameLength.java
More file actions
39 lines (30 loc) · 1.06 KB
/
Copy pathnameLength.java
File metadata and controls
39 lines (30 loc) · 1.06 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
public class nameLength {
public static void main(String[] args) {
String name = "Hottertrottel";
int nameLength = name.length();
boolean fancy = name.contains("fancy");
System.out.println(fancy);
System.out.println(name.toLowerCase());
System.out.println(name.toUpperCase());
System.out.println(name.length());
System.out.println(nameLength);
lengthTest(nameLength);
containsFancy(name);
conclusion(nameLength);
}
public static boolean lengthTest(int nameLength){
if (nameLength >= 20)
System.out.println("name is longer than 20 digits");
else
System.out.println("name is shorter than 20 digits");
return nameLength>=20;
}
public static boolean containsFancy(String name){
System.out.println(name.contains("fancy"));
return name.contains("fancy");
}
public static boolean conclusion(int nameLength){
System.out.println(nameLength);
return lengthTest(nameLength);
}
}