-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathArrayLimit.java
More file actions
35 lines (33 loc) · 759 Bytes
/
Copy pathArrayLimit.java
File metadata and controls
35 lines (33 loc) · 759 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
class Main {
public static void main(String[] args) {
Olho[] ol = new Olho[2];
ol[0] = new Olho("Castanho", true);
ol[1] = new Olho("Azul", false);
ol[0].verificar();
}
}
class Olho {
private String cor;
private boolean funciona;
public String getCor() {
return cor;
}
public void setCor(String cor) {
this.cor = cor;
}
public Boolean getFunciona() {
return funciona;
}
public void setFunciona(Boolean funciona) {
this.funciona = funciona;
}
public Olho(String cor, Boolean funciona) {
this.cor = cor;
this.funciona = funciona;
}
public void verificar() {
System.out.println("A cor do olho é: " + getCor());
System.out.println("O olho funciona ? " + getFunciona());
}
}
//https://pt.stackoverflow.com/q/433966/101