Mesa
/*
* Write a description of class Mesa here.
*
* @author (Amalio)
* @version (v1)
*/
public class Mesa{
// instance variables - replace the example below with your own
private int numPatas;
private String color;
private String forma;
/**
* Constructor for objects of class Mesa
*/
public Mesa()
{
}
/*
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public Mesa(int numPatas,String color,String forma){
this.numPatas = 7;
this.color = "bermellón";
this.forma = "redonda";
}
public String cambiarcolor(String amarillo){
this.color = "amarillo";
return "amarillo";
}
public String toString(){
System.out.println("numero de patas "+numPatas+" color "+color+" forma "+forma);
return (numPatas+" color "+color+" forma "+forma);
}
public static void main(String[]arg){
int numPatas = 7;
String forma = "redonda";
String color = "amarillo";
//Mesa m = new Mesa(numPatas,color,forma);
Mesa m = new Mesa(numPatas,color,forma);
String cambiarcolor("amarillo");
m.toString();
}
}
Comentarios
Publicar un comentario