Problem

Assume that you have already successfully written a class named Students that handles stud...

Assume that you have already successfully written a class named Students that handles student records for the Registrar’s office. Assume that the Students class:

• Contains a studentIds instance variable—an array of ints that contains student ID numbers.

• Contains a 1-parameter constructor that initializes the studentIds instance variable.

• Contains this main method:

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 main

Write a public method named equals for your Students class that tests whether two Students objects are equal. Your equals method should be written such that the above main method would produce this output:

s1 == s3

Only provide code for the asked-for equals method; do not provide code for the entire Students class.

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 10
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT