JAVA学习记录
Posted: 6月 16, 2011 | 作者: mec0825 | Filed under: ACM | Tags: JAVA |
JAVA学习
最近刚学习JAVA,想把一些重要的东西记录下来方便自己查找
下面记录的都是已经用过的,没用过的以后再加
JAVA程序的大体结构:
import java.*
public class Main {
type val;
static function_name(type arg1, type arg2){
}
static class class_name {
}
public static void main(String argv[]) {
}
}
JAVA中的基本类型 long 为 C++ 中的 long long
JAVA中的自带类型
BigDecimal BigInteger
JAVA的输入输出:
Scanner cin = new Scanner(System.in);
cin.hasNext() 判EOF
System.out.println();
System.out.printf();
JAVA中的比较函数
static class pnt implements Comparable<pnt>{
int x, y;
pnt(int xx, int yy) {x = xx; y = yy;}
public int compareTo(pnt p){
if(x > p.x) return 1;
else if(x == p.x){
if(y > p.y) return 1;
else if(y == p.y) return 0;
else return -1;
}
else return -1;
}
}
JAVA中的函数
Arrays.sort(object, begin, end);
JAVA中的容器
PriorityQueue