forked from sylviot/algoritmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCondition.java
More file actions
55 lines (49 loc) · 916 Bytes
/
Condition.java
File metadata and controls
55 lines (49 loc) · 916 Bytes
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
51
52
53
54
55
import java.util.*;
import java.lang.*;
import java.io.*;
class Condition
{
public static void main (String[] args) throws java.lang.Exception
{
/* IF */
// IF simples (Apenas exemplo)
if(true)/* Condição booleana */
{
// Se a condição for verdadeira.
}
// Multiplos IFs (Apenas exemplo)
if(true)
{
}
else if(true)
{
}
// Multiplos IFs com ELSE (Apenas exemplo)
if(true)
{
}
else if(true)
{
}
else
{
// Caso nenhuma condição dos IFs for verdadeira
}
// Operador ternário
String v_ou_f = (true) ? "Verdadeiro" : "Falso";
/* SWITCH */
int number = 1;
switch(number)
{
case 1:
System.out.println("Number 1");
break;
case 2:
System.out.println("Number 2");
break;
default:
System.out.println("Default");
break;
}
}
}