If i pass null set.put(null), it gives me NullPointer Expection, i know nullponter means its trying to refer th object with null reference in memory. Correct me if iam wrong
I guess you want '||' in your equals method instead of '&&'.
You get the NullPointerException on the line System.out.println("Set contains --" + t.count); You get null from the Set, so t == null, so t.count gives you the exception. So you don't get the exception in the setting, but in the getting
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Gift giving made easy with the permaculture playing cards