Accenture NJ mostly ask question on Collection like
1)How to sort Objcts and how treeset sort them
2)Explain mechanism of Hashcode finding in Java
3)Name some of the Sorted collection.

Answer Posted / aditya sharma

1)How to sort Objcts and how treeset sort them
Ans: *) We can sort objects using comparable and comparator
interface.
*) Treeset sort object using comparable interface.
2) Explain mechanism of Hashcode finding in Java
Ans:
1) Write [ java *Class name* ] = you will get class name and
hashCode no.
2) Implement the hashCode method in your class and call
hashCode method.
3) Name some of the Sorted collection.
Ans:
1) TreeSet
2) TreeMap

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the inheritance?

540


What is the function of java?

508


Difference between string, stringbuffer and stringbuilder?

562


Can long be null in java?

538


Which sorting is best in java?

526






What is a double vs float?

528


What is boolean strategy?

618


What is an immutable class? How to create an immutable class?

532


What is java virtual machine? Explain

561


What is the purpose of using break in each case of switch statement?

559


What is mean by collections in java?

560


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

522


Differentiate between overriding and overloading cases?

586


How do you reverse a list?

545


How do you break a loop?

555