1.低精度可转高精度,int 低精度,double高精度(存储位数多)
double a=10;
2. 输出的i–也会赋值
sout(i++);
i++;
3.数组定义不合法(赋值只能指定任意一者)
int []b={1,2,3};
int b[]=new int{1,2,3};
int b[]=new int[];//(**x**)没有指定长度
int b[]=new int[3]{1,2,3}; //(x)不能既指定元素又指定空间个数
- 父=子
Set a=new HashSet();
5.没有catch也可以
try{
}finally{
}
6.接口都是抽象方法和静态成员
7.抽象类不能实例化
Father f=new abtractSon();
8.自定义异常类
try{
}
catch(MyException e)
{
}
void exfun() throws MyException{
throw new MyException();
}
9.考试错误
int a[][] =new int [2][9]
a.length //2
a[0].length//9
实例方法(对象的方法)子类重写不可以重写变为子类static方法
//子类在方法重写时,不可以把父类的实例方法重写为类(static)方法,也不可以把父类的类(static)方法重写为实例方法。
有static就变为类的方法 A.f1(); //不可以static覆盖, 都是单独的
实例方法 :new对象的方法
//可变参数
public void f(int ...x){
for(int k:x){
sum+=k;
}
}