-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTesteIdade.java
More file actions
33 lines (24 loc) · 970 Bytes
/
TesteIdade.java
File metadata and controls
33 lines (24 loc) · 970 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
// Declarando e usando variáveis
class TestaIdade {
public static void main(String[] args) {
// INT << Tipo de Váriavel IDADE << Nome da váriavel
int idade;
idade = 15;
System.out.println(idade);
// Calcula a idade no ano seguinte usando operadores.
int idadeNoAnoQueVem;
idadeNoAnoQueVem = idade + 1 * 4 - 3 / 6;
System.out.println(idadeNoAnoQueVem);
// Guarda frações e numeros inteiros
double pi = 3.14;
double x = 5 * 10;
System.out.println(pi);
System.out.println(x);
// Expressão Booleana
boolean menorDeIdade = idade < 18;
System.out.println(menorDeIdade);
// Guarda apenas um caractere
char letra = 'a';
System.out.println(letra);
}
}