Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started