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
Is vector synchronized in java?
What is private protected in java?
Can we clone singleton class in java?
Is simpledateformat safe to use in the multithreaded program?
What is this keyword used for?
How do you test a method for an exception using junit?
What is difference between static and final?
What does the @override annotation do?
what is the difference between the methods sleep() and wait()? : Java thread
Does constructor be static?
Difference between string s= new string (); and string s = "abv";?
What is string subsequence method?
What is the difference between JVM and JRE?
How are destructors defined in java?
How do you sort a string in java?