Strings: 1.) Print Duplicates of an array with one Loop statement? package com.java.testing; import java.util.HashSet; import java.util.Set; class MyClass { public static Set<Integer> commonNumbers = new HashSet<>(); public Integer digits; public MyClass(Integer digits) { this.digits=digits; } @Override public int hashCode() { return 0; } @Override public boolean equals(Object obj) { if(obj instanceof MyClass) { if(this.digits.equals(((MyClass)obj).digits)) { commonNumbers.add(((MyClass)obj).digits); return true; } } return false; } } public class ObenStringQuestion { public static void main(String[] args){ int[] mobileno = new int[]{1,8,8,8,8,8,8,1,4,2,8,2,1,1,6,2}; Set<MyClass> xx = new HashSet<>(); for(int i=0;i<mobileno.length;i++) { xx.add(new MyClass(mobileno[i])); } for (MyClass object : xx) { System.out.println(object.digits);...
In race to achieve proactive Developing.