Click here to watch in Youtube :
https://www.youtube.com/watch?v=mohRInH9h-U&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Generate hashCode and equals method using eclipse |
Java Tutorial : Generate hashCode and equals method using eclipse |
Java Tutorial : Generate hashCode and equals method using eclipse |
Java Tutorial : Generate hashCode and equals method using eclipse |
public class Employee { private String name; private int age; private int salary; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + age; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + salary; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Employee other = (Employee) obj; if (age != other.age) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (salary != other.salary) return false; return true; } }
https://sites.google.com/site/javaee4321/java/GenerationDemo_Eclipse_hashcode_equals_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/GenerationDemo_Eclipse_hashcode_equals_App/GenerationDemo
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d8bcbd739d9d2ceaeec7ee56b1959925c6ec69d4/BasicJava/GenerationDemo_Eclipse_hashcode_equals_App/GenerationDemo/?at=master
See also:
No comments:
Post a Comment