import java.util.*;
class Point implements Comparable{
int x;
int y;
public Point(){
x = 0;
y = 0;
}
public void setarg( int x, int y ){
this.x = x;
this.y = y;
}
public int getx(){
return x;
}
public int gety(){
return y;
}
public int compareTo( Object tmp ){
Point res = ( Point )tmp;
if( x < res.x || x == res.x && y < res.y ){
return -1;
}
else{
return 1;
}
}
}
public class Main{
/*
boolean comparetor( Point a, Point b ){
if( a.x < b.x | a.x == b.x && a.y < b.y ){
return true;
}
else{
return false;
}
}
*/
public static void main( String args[] ) throws Exception{
Point [] res = new Point[10];
for( int i = 0; i < res.length; i++ ){
res[i] = new Point();
}
for(int i = 0; i < res.length; i++){
res[i].setarg( i * i - 10 * i + 25, 0 );
}
Arrays.sort( res );
for( int i = 0; i < res.length; i++ ){
System.out.println( res[i].getx() + res[i].gety() );
}
}
}
posted on 2009-08-22 21:55
Huicpc217 阅读(1286)
评论(0) 编辑 收藏 引用 所属分类:
JAVA 、
模板