Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by nhnb ( 19 years ago )
import java.util.HashSet;


public class Test {

	private int hashCode = 0;
	
	public int hashCode() {
		return hashCode;
	}
	
	public boolean equals() {
		return true;
	}
	
	public static void main(String[] args) {
		HashSet h = new HashSet();
		Test a = new Test();
		h.add(a);
		a.hashCode = 1;
		h.add(a);
		System.out.println(h);
	}
	
}

 

Revise this Paste

Your Name: Code Language: