-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPonto.java
More file actions
executable file
·51 lines (40 loc) · 976 Bytes
/
Ponto.java
File metadata and controls
executable file
·51 lines (40 loc) · 976 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
public class Ponto {
private int x, y;
public Ponto(){
this.x = 2;
this.y = 3;
}
public Ponto(int x){
this.x = x;
this.y = -1;
}
public Ponto(int x, int y){
this(x);
this.y = y;
}
public int getX(){
return this.x;
}
public int getY(){
return this.y;
}
public void setX(int x){
this.x = x;
}
public void setY(int y){
this.y = y;
}
public String toString(){
return "X="+this.x+" Y="+this.y;
}
public static void main(String args[]){
Ponto p = new Ponto();
System.out.println("Ponto P x="+p.getX()+" y="+p.getY());
Ponto q = new Ponto();
q.setX(10);
q.setY(5);
System.out.println("Ponto Q x="+q.getX()+" y="+q.getY());
Ponto z = new Ponto(100,33);
System.out.println("Ponto Z x="+z.getX()+" y="+z.getY());
}
}