Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Persona implements Comparable<Persona> {
- private String Nombre;
- private String Apellido;
- private Integer DNI;
- private String Estado;
- public Persona() {
- }
- public Persona(String name,String last,Integer dni,String state) {
- this.Nombre=name;
- this.Apellido=last;
- this.DNI=dni;
- this.Estado=state;
- }
- public void setNombre(String name){
- this.Nombre=name;
- }
- public String getNombre() {
- return this.Nombre;
- }
- public void setApellido(String last){
- this.Apellido=last;
- }
- public String getApellido() {
- return this.Apellido;
- }
- public void setDNI(Integer dni){
- this.DNI=dni;
- }
- public Integer getDNI(){
- return this.DNI;
- }
- public void setestado(String state){
- this.Estado=state;
- }
- public String getEstado(){
- return this.Estado;
- }
- public String toString() {
- return" Dni: " +DNI+ " - "+Apellido + ", " + Nombre + " - " + Estado + "\n";
- }
- @Override
- public int compareTo(Persona o) {
- // TODO Auto-generated method stub
- return this.DNI.compareTo(o.getDNI());//Ordena por Dni
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement