Assume that you have already successfully written a class named
Studentsthat handles student records for the Registrar’s office. Assume that the
Studentsclass:
• Contains a
studentIdsinstance variable—an array ofintsthat contains student ID numbers.• Contains a 1-parameter constructor that initializes the
studentIdsinstance variable.• Contains this
mainmethod:
public static void main(String[] args){ Students s1 = new Students(new int[] {123, 456, 789}); Students s2 = new Students(new int[] {123, 456, 789, 555}); Students s3 = new Students(new int[] {123, 456, 789}); if (s1.equals(s2)) { System.out.println("s1 == s2"); } if (s1.equals(s3)) { System.out.println("s1 == s3"); }} // end mainWrite a
publicmethod named
equalsfor your
Studentsclass that tests whether two
Studentsobjects are equal. Your
equalsmethod should be written such that the above
mainmethod would produce this output:
s1 == s3
Only provide code for the asked-for
equalsmethod; do not provide code for the entire
Studentsclass.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.