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

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
Get step-by-step solutions from verified subject matter experts
