-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaIntro2.java
More file actions
18 lines (14 loc) · 1012 Bytes
/
JavaIntro2.java
File metadata and controls
18 lines (14 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class JavaIntro2 { //This creates the "class", for now think of each class like a document or file
public static void main(String[] args) { //This line lets Java know what to run when you click execute below
boolean b1 = true; //boolean variables can only hold true or false
boolean b2 = false;
System.out.println("AND: b1 && b2: " + (b1 && b2)); //&& is AND, only when both values are true is && true
System.out.println("OR: b1 || b2: " + (b1 || b2)); //|| is OR, when either value is true || is true
System.out.println("NOT: !b1: " + !b1); //! is NOT, ! changes true to false, or false to true
int x = 10;
int y = 20;
System.out.println("x < y: " + (x < y)); //<, >, and == are comparison operators, they result in booleans
System.out.println("x > y: " + (x > y)); //<=, >=, and != are also comparison operators, what do they do?
System.out.println("x == y: " + (x == y));
} //End of main
} //End of JavaIntro2