ex1 class

PHOTO EMBED

Mon Nov 04 2024 18:46:29 GMT+0000 (Coordinated Universal Time)

Saved by @saharmess #java

class Client{
    private String nom;
    private String prenom;
    private Long tel;
    Client(String nom , String prenom, Long tel){
        this.nom=nom;
        this.prenom=prenom;
        this.tel=tel;
    }
    public String toString(){
       return("nom:"+this.nom+" et le prenom:"+this.prenom+" et le telephone:"+this.tel);
    }
   String getNom(){
       return nom;
       } 
    String getPrenom(){
        return prenom;
       }
    Long getTel(){
        return tel;
    }
    void setNom(String ch){
        this.nom=ch;
    }
    void setPre(String ch){
        this.prenom=ch;
}
void setTel(Long t){
        this.tel=t;
}
public Boolean equals(Client c){
    return c !=null && c.nom.equals(this.nom) && c.prenom.equals(this.prenom) && c.tel.equals(this.tel); 
}
public static void main(String [] args){
    Client c=new Client("sahar","mess",99836678l);
    Client clt=new Client("sahar","mess",99836678l);
    System.out.println(c.equals(clt));
    System.out.println(c);
}
}
content_copyCOPY