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 the default value of an object reference declared as an instance variable?
Explain oops concepts in detail?
Can we call the run() method instead of start()?
Why can't we make a class private in java?
Explain about collection interface in java?
When should you make a function static?
What is meant by inheritance and what are its advantages?
how to write a program for sending mails between client and server
What kind of variables a class can consist of?
What is __ init __ functions?
Does collectionutils isempty check for null?
How do you convert string to int in java?
How do you use substring in java?
Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?
How to display all the prime numbers between 1 and n (n is the number, get the input from user)