-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInClassDemo1_20.java
42 lines (34 loc) · 941 Bytes
/
InClassDemo1_20.java
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
40
41
42
import java.util.Scanner;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class InClassDemo1_20{
public static void main(String[]args){
//get input from dialog box
Scanner s = new Scanner(System.in);
int n;
n = s.nextInt();
boolean crazy;
if (n>3) {
crazy = true;
System.out.println("are you crazy?");
}
else {
crazy = false;
if (n < 1){
System.out.println("none?really?");
}
else {
System.out.println("else statement");
}
}
System.out.println(crazy);
}
}
// logical operators
// == (equal)
// != (not equal)
// && (and)
// || (or)
// if (! (n<5)) not operator
// value1.equals(value2) is a strict comparison ouput true or false. With strings, compares ASCII values.
// value1.compareTO(value2) displays the difference.