I have one POJO class(Java bean class), it has two
variables for that it has setters and getters. Now i have
created two objects for that class and i have set the data
for those variables through this two objects. Now question
is i want check whether those two objects have same data or
not, for this write a program? Thanks, Bose.
Answer Posted / murli
override equals method from object class and have the comparison logic inside that.Also override hashcode method..
Now pBeanOne.equals(pBeanTwo) will give you the result
Is This Answer Correct ? | 13 Yes | 0 No |
Post New Answer View All Answers
What is the difference between the paint() and repaint() methods?
Does substring create a new object?
why Interface used?
Why map is used in java?
What are implicit objects in java?
What is a nullable field?
What are the types of arrays in java?
How can we make sure main() is the last thread to finish in java program?
What is singleton class example?
What is widening and narrowing in java? Discuss with an example.
Explain about fail fast iterators in java?
Do we need to manually write Copy Constructor?
How are multiple inheritances done in Java?
Difference between ‘>>’ and ‘>>>’ operators in java?
How can we create a thread in java?