Am I doing getters/setters the right way in Java?
Posted
by Sergio Tapia
on Stack Overflow
See other posts from Stack Overflow
or by Sergio Tapia
Published on 2010-05-12T01:02:28Z
Indexed on
2010/05/12
1:14 UTC
Read the original article
Hit count: 336
public class Persona {
int Codigo;
String Nombre;
public Persona(int Codigo, String Nombre){
this.Codigo = Codigo;
this.Nombre = Nombre;
}
public void setCodigo(int Codigo){
this.Codigo = Codigo;
}
public int getCodigo(){
return this.Codigo;
}
public void setNombre(String Nombre){
this.Nombre = Nombre;
}
public String getNombre(){
return this.Nombre;
}
}
Or is there a much shorter (realiable) way to do it?
© Stack Overflow or respective owner