Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

会java的帮忙看下,为什么第一个输出 true 第二个是 false 呢?

Posted by 20053565 at 2008-04-04 23:42:38 and last updated at 2008-04-04 23:43:58
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator