Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class JavaStudents { } int id; String name; String city; JavaStudents (int id, String name, String city) { this.id=id; this.name=name; this.city-city; } public
public class JavaStudents { } int id; String name; String city; JavaStudents (int id, String name, String city) { this.id=id; this.name=name; this.city-city; } public static void main(String args[]) { } JavaStudents s1=new JavaStudents (5107952, "Steve", "Melbourne"); JavaStudents s2=new JavaStudents (5102938, "Randall", "Sydney"); System.out.println(s1); System.out.println(s2); Re-write the above code to produce the desired output as follows, using toString() method. 5107952 Steve Melbourne 5102938 Randall Sydney
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the rewritten code incorporating the toString method to produce the desired output public clas...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