How to sort a vector elements that contains the user define
class object? (Note: If Suppose consider, A Student class
contain two data members. They are String studentName and
int rollNo. I am creating Four objects for this class, each
object contains students details like name and roll no. Now
i am storing that objects in vector and if i retiving the
elements from the vector means then it should be display in
sorting order)
Answer Posted / kalyan g
other way to achieve this is implementing comparator
interface and implement compare(object) method.
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is this keyword used for?
What is identifier with example?
What are the loops in java?
How does list work in java?
Is string passed by reference in java?
Variable of the boolean type is automatically initialized as?
Is it possible to override the main method?
Is ++ operator thread-safe in java?
What are meta-annotations?
What is java util?
What is string manipulation?
What do you mean by JVM?
Are static members inherited to sub classes?
How do you use parseint in java?
What is nested loop? What is dangling else condition in it?