java - method in uml diagram -


i have uml diagram , don't understand part of code have friend . don't understand "equals" method.. used , why should use ?
uml : enter image description here

but don't understand part of code .

this part of code far :

class artist {   private string name;  artist(string name) { // constructor     this.name = name; }  public string getname() { // name getter     return name; }  public string tostring() { // tostring     return name; } }  class cd {  private string title; private artist name;  cd(string title) {     this.title = title; }  cd(string title, artist name) {     this.title = title;     this.name = name; }  public artist getartist() {     return name; }  public string gettitle() {     return title; }  public string tostring() {     return title + " " + getartist(); }  @override public boolean equals(object obj) {     if (this == obj)         return true;     if (obj == null)         return false;     if (getclass() != obj.getclass())         return false;     cd other = (cd) obj;     if (name == null) {         if (other.name != null)             return false;     } else if (!name.equals(other.name))         return false;     if (title == null) {         if (other.title != null)             return false;     } else if (!title.equals(other.title))         return false;     return true; } 

}

the class diagram misses cd inherits general object provides equals method. correctly should like

enter image description here

(my java knowledge near null.)


Comments

Popular posts from this blog

php - Cannot override Laravel Spark authentication with own implementation -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -