| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
会java的帮忙看下,为什么第一个输出 true 第二个是 false 呢?import java.util.*;
public class Main
{
class TPoint
{
String x, y;
public TPoint(String x,String y)
{
this.x = x;
this.y = y;
}
}
public static void main(String [] args)
{
new Main().run();
}
public void run()
{
Map <TPoint, Integer> map = new HashMap <TPoint, Integer> ();
TPoint p = new TPoint ("0", "0");
map.put(p, new Integer (1));
System.out.println(map.containsKey(p));
TPoint q = new TPoint ("0","0");
System.out.println(map.containsKey(q));
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator