Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
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