-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathRelationalFun.java
More file actions
36 lines (25 loc) · 1.06 KB
/
Copy pathRelationalFun.java
File metadata and controls
36 lines (25 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
public class RelationalFun {
public static void main(String[] args) {
boolean myBool = true;
boolean yourBool = false;
int myAge = 37;
int yourAge = 20;
int bobsAge = 20;
String myName = "John";
String yourName = "Johnny";
System.out.println("myBool is " + myBool);
System.out.println("yourBool is " + yourBool);
//relational operations
boolean ageComparison = myAge > yourAge;
System.out.println("myAge > yourAge?: " + ageComparison);
ageComparison = yourAge > bobsAge;
System.out.println("yourAge > bobsAge?:" + ageComparison);
ageComparison = yourAge == bobsAge;
System.out.println("yourAge == bobsAge?: " + ageComparison);
boolean nameComparison = myName.equals(yourName);
System.out.println("do names match?: " + nameComparison);
int currentAge = 37;
boolean isGreater21 = currentAge >= 21;
System.out.println("currentAge >= 21?: " + isGreater21);
}//end main
}