Question: data structure java language 4. What is the output of the following program? class student 1 int id, String name; String grade; public student(int id,

data structure java language
data structure java language 4. What is the output of the following

4. What is the output of the following program? class student 1 int id, String name; String grade; public student(int id, String name, String grade)f this id =id; this. name = name; this grade = grade; @Override public String toString() I return "Student!" + "idn" + id +", name=" + name + ", grade =+grade +7: Set> names = new HashSet> (1): Setestudent> st a new HashSet1); student s1 = new student(1, "Mohammad". "A+"); student s2 = new student(2, "Ahmed", "A"): student s3 = new student(3, "Sara", "A"): student s2 = new student(4, "Fatima", "A+"); st.add(s1); st.add(s2); st.add(s3); st.add(s4); st.add(s4); names.add("Mohammed Khalid 1"): names.add("Mohammed Khalid 2"): names.add("Mohammed Khalid3"): names. add("Mohammed Khalid3"): names.add("Mohammed Khalid2"): for (String name: names) \{ System.out.print(namet" "): // 1 for (student u: st) \{ System.out.println(u)

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!