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


Please Help Members By Posting Answers For Below Questions

What is a condition in programming?

554


Explain about oops concepts.

630


What do you mean by synchronized non access modifier?

560


What data type is true or false?

571


What is the meaning of immutable regarding string?

516






What is connection class in java?

508


What is java virtual machine and how it is considered in context of java’s platform independent feature?

651


Write an algorithm for quick sort?

615


What is public static void main?

565


What is the finalize method do?

594


Explain the difference between private, public, package and protected in java?

594


Why are getters and setters used?

567


What is exception handling in java?

573


What is a null class?

568


What is linked hashmap and its features?

538