IN JAVA using any of the sort methods The object class should be a Student with
ID: 3708203 • Letter: I
Question
IN JAVA using any of the sort methods
The object class should be a Student with the following attributes:
id: integer
name: String
write the accessors, mutators, constructor, and toString().
In your main test class you will write your main method and do the following things:
Create an array of Student objects with at least 5 students in your array.
The sort method must be written yourself and included in the main class. The sort
method will sort based on student id.
Output the array out in unsorted order as it exists.
Sort the array
Output the sorted array
Explanation / Answer
Hi Dear,
Please find my implementation.
Output:
Enter student 1 Id: 333
Enter student 1 Name: Suresh
Enter student 2 Id: 222
Enter student 2 Name: Sekhar
Enter student 3 Id: 111
Enter student 3 Name: Anshu
Enter student 4 Id: 555
Enter student 4 Name: Revath
Enter student 5 Id: 444
Enter student 5 Name: Murapaka
Before Sorting, Student array elements:
Student ID: 333 Student Name: Suresh
Student ID: 222 Student Name: Sekhar
Student ID: 111 Student Name: Anshu
Student ID: 555 Student Name: Revath
Student ID: 444 Student Name: Murapaka
After Sorting, Student array elements:
Student ID: 111 Student Name: Anshu
Student ID: 222 Student Name: Sekhar
Student ID: 333 Student Name: Suresh
Student ID: 444 Student Name: Murapaka
Student ID: 555 Student Name: Revath