Question: 15. (35) Consider the following program segment and student class. Student to - new Student (17); System.out.println(tom.getAge()); Student clone - tom.copy(); alone.setAge(21), System.out.println(clone.getAge()); System.out.println(ton.getAge()); class

 15. (35) Consider the following program segment and student class. Student

15. (35) Consider the following program segment and student class. Student to - new Student (17); System.out.println(tom.getAge()); Student clone - tom.copy(); alone.setAge(21), System.out.println(clone.getAge()); System.out.println(ton.getAge()); class Student private int age; public Student(int a) { age = a; } public Student copy() { return this; } public int getAge() { return age; ) public void setAge(int a) { age - a; } What is printed as a result of executing the program? (A) 17 (B) 17 (D) 21 (E)

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!