Me puedes decir sobre este código de java
Public class Punto extends Figura {
private double x;
private double y;
public Punto(){
x=0;
y=0;
}
public Punto(double cx,double cy){
x=cx;
y=cy;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
public void ponX(double d){
x=d;
}
public void ponY(double d){
y=d;
}
public void desplaza(double deltaX,double deltaY)
{
x+=deltaX;
y+=deltaY;
}
public String toString(){
return"("+x+","+y+")";
}
public boolean esCerrada(){
return false;
}
public void leer(){
}
}
para que sirve la clase public String toString(){
private double x;
private double y;
public Punto(){
x=0;
y=0;
}
public Punto(double cx,double cy){
x=cx;
y=cy;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
public void ponX(double d){
x=d;
}
public void ponY(double d){
y=d;
}
public void desplaza(double deltaX,double deltaY)
{
x+=deltaX;
y+=deltaY;
}
public String toString(){
return"("+x+","+y+")";
}
public boolean esCerrada(){
return false;
}
public void leer(){
}
}
para que sirve la clase public String toString(){
1 Respuesta
Respuesta de alejosoft
1