论坛首页 入门技术论坛

数组能否正确打印数据

浏览 1486 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-07-29  
class Test
{
	public static void main(String args[])
	{
		Test1 t1 = new Test1(1);
		Test1 t2 = new Test1(2);
		Test1 t3 = new Test1(3);
		
		Test1[] tt = new Test1[3];
		
		tt[0] = t2;
		tt[1] = t3;
		tt[2] = t1;

		Arrays.sort(tt);
		
		for(int i = 0; i < tt.length; i++)
		{
			System.out.println(tt[i]);
		}
	}
}

class Test1
{
	int i;
	Test1(int i)
	{
		this.i = i;
	}
	。。。。。。。。
 }
 
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics