-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperadores.java
More file actions
50 lines (39 loc) · 1.04 KB
/
Operadores.java
File metadata and controls
50 lines (39 loc) · 1.04 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
40
41
42
43
44
45
46
47
48
49
50
public class Operadores {
//Unários
static int x = 3;
//Binários
static double y = 3 + 2;
//Ternário
static boolean result = x < y ? true: false;
public static void main(String[] args) {
System.out.println(x);
System.out.println(y);
System.out.println(result);
System.out.println("===Ordem de Precedência de calculo===");
int p1 = 2 * 5 + 3 * 4 - 8;
/**
* int p1= 2 * 5 + 3 * 4 - 8;
* int p1= 10 + 12 -8
* int p1= 22 - 8
* int p1= 14
*/
System.out.println(p1);
int p2 = 2 * ((5+3)* 4 - 8);
/**
* int p2 = 2 * ((5+3)* 4 - 8);
* int p2 = 2 * ((8)* 4 - 8);
* int p2 = 2 * (32 - 8);
* int p2 = 2 * 24;
* int p2 = 48;
*/
System.out.println(p2);
int x = 3;
int y = ++x * 5 / x-- + --x;
/**
* int y = 4 * 5 / 4 + 2;
* int y = 20 / 4 + 2;
* int y = 5 + 2;
* int y = 7;
*/
}
}