Question: What is the output of the following code? class Student implements Cloneable { int id; Student (int id) { this.id id; } public static
What is the output of the following code? class Student implements Cloneable { int id; Student (int id) { this.id id; } public static void main(String[] args) throws CloneNot SupportedException { Student s1= new Student (9); Student s2 = (Student) si.clone(); s1.id = 18; System.out.println(s1.id+" "+s2.id); }
Step by Step Solution
★★★★★
3.43 Rating (153 Votes )
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
The image contains Java code for a class named Student that implements the Cloneable interface The S... View full answer
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
