Question: JAVA What will be the output of compiling and executing the code below? Write your answer without space 1 1 import java.util.*; 2 public class

JAVA

JAVA What will be the output of compiling and executing the code

What will be the output of compiling and executing the code below? Write your answer without space 1 1 import java.util.*; 2 public class Test { 3 public static void main(String[] args) { 4 Set set = new HashSet(); 5 set.add(new A(); 6 set.add(new A); 7 set.add(new A); 8 set.add(new A(); 9 System.out.println(set); 10 } 11 } 12 13 class A { 14 int r = 1; 15 public String toString() { 16 return r + ""; 17 } 18 public int hashCode () { 19 return r; } 21 } 20 Your

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!