Question: 2 public class HW2 { public static void main(String[] args) { Circle c1 = new Circle(); Circle c2 = new Circle); c1. radius = 10.0;

 2 public class HW2 { public static void main(String[] args) {

2 public class HW2 { public static void main(String[] args) { Circle c1 = new Circle(); Circle c2 = new Circle); c1. radius = 10.0; 12 //c1's id String circle_id_1 = ct.getClass().getName() + "@" + Integer. toHexString(System. identityHashCode(c1)); //c2's id String circle.id 2 = c2.getClass().getName() + "@" + Integer.toHexString(system. identityHashCode(c2)); 13 c2 = 1; //To-Do: 1. print radius and circle id for both c1 and c2 553A22 String s1 = "Java rocks!"; String s2 = "Java rocks!"; String s3 = new String("Java rocks"); //s1's id String str_id_1 = s1.getClass().getName() + "@" + Integer.toHexString(System. identityHashCode(s1)); //s2's id String str_id_2 = s2.getClass().getName() + "@" + Integer.toHexString(System. identityHashCode(s2)); //s3's id String str_id_3 = s3.getClass().getName() + "@" + Integer. toHexString(System. identityHashCode($3)); 28 //To-Do: 2. print s1, s2, and s3 ids //To-Do: 3. change s1, s2, and s3 to "Hello Java" using the new operator // For example, s1 = new String("Hello Java"); // Don't use string literal, e.g., s1 ="Hello Java"; 33 //To-Do: 4. Then, update and show their id again

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!