1.什么是索引,索引的作用是什么?
索引是对数据库表中一列或多列的值进行排序的一种结构,使用索引可快速访问数据库表中的特定信息
索引的一个主要目的就是加快检索表中数据的方法,亦即能协助信息搜索者尽快的找到符合限制条件的记录ID的辅助数据结构。
2.public class TestInteger {
public static void main(String args[]){
Integer a=new Integer(3);
Integer b=new Integer(3);
int c=3;
Integer d=3;
System.out.println(a==b);
System.out.println(b==c);
System.out.println(a==d);
System.out.println(c==d);
//Integer会自动拆箱为int,所以为true
//a和b。 a是新建的对象所以和d地址值不同。
}
}
输出结果
false
true
false
true
3.java 中 父类和子类方法的调用顺序 总结起来就是先 父类静态块 (只调用一次,即创建第二个对象的时候不调用)
方法一般调用顺序总结 父类静态块-子类静态块-父类构造方法-子类构造方法-普通方法(如果子类方法名和父类方法名相同,覆盖)
特殊情况 如果创建两个子对象 则调用顺序 为 父类静态块-子类静态块-父类构造方法-子类将构造方法-父类构造方法-子类构造方法-普通方法
举例:
父类package com.test;
/**
* @author :hanzl
* @version 创建时间:2018年3月12日 下午1:54:07
*/
public class Parent {
static {
System.out.println("i m parent static ===父类静态块");
}
public Parent(){
System.out.println("i .m parent gouzao===父类构造方法");
}
public void sayhello(){
System.out.println("hello i m parent pu tong ==父类sayhello方法");
}
public static void method2(){
System.out.println("hello i m parent method2 ==父类静态方法");
}
}
子类:
package com.test;
/**
* @author :hanzl
* @version 创建时间:2018年3月12日 下午1:56:20
*/
public class Child extends Parent {
public static void main(String args[]){
//Parent parent=new Parent();
Parent c=new Child();
Parent d=new Child();
}
static {
System.out.println("i m child static=== 子类静态快");
}
/*static void sayhello(){
System.out.println("i m child sayhello");
}*/
public void sayhello(){
System.out.println(" im child pu tong ==子类普通方法");
}
public Child(){
System.out.println("Child gouzao===子类构造方法");
}
public static void method2(){
System.out.println("hello i m child method2 ==子类静态方法");
}
}
方法调用结果:
i m parent static ===父类静态块
i m child static=== 子类静态快
i .m parent gouzao===父类构造方法
Child gouzao===子类构造方法
i .m parent gouzao===父类构造方法
Child gouzao===子类构造方法
hello i m parent method2 ==父类静态方法
4.double和float的区别
这样的话会报错,会提示不能将double转化为float类型,默认的小数是double类型的
如果 float a=1.3f才是正确的。
double b=1.5f; 则不会报错,高级赋给低级会报错,低级赋给高级不会报错。
5.java 集合类
1).List(有序,可重复)
2)Set(无序,不能重复)
3)Map(键值对,建唯一,值不唯一)