Question: QUESTION 9 Given below is a class that represents a student with three attributes: studentId, name and course. public class Student{ private String id, name,

 QUESTION 9 Given below is a class that represents a student

QUESTION 9 Given below is a class that represents a student with three attributes: studentId, name and course. public class Student{ private String id, name, course; Student(String i, String n, String c){ id = i; name = n; course - C; } public String id(){return id;} public String name(){return name;} public String course(){return course;} public String toString(){return id+" "+name+""+course;} } Your task is to write the following methods for the Student class: equals, that returns true if two instances of the account class have the same id; (6 marks) hashCode, that returns a hash code for an instance of the class.(4 marks) Total (10 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!