1.LinkedList 的插入和删除的速度更快;对于随机访问,ArrayList性能更加好。
linkedList适合操作
ArrayList访问速度更快
2.jquery中str转double:
Double.parseDouble(String);
Double.valueOf(String).doubleValue();
3.如下代码:(无法被编译,无法抛出异常)
public static void main(String[] args) {
RuntimeException re = null;
throw re;
}
4.查询出重复数据的sql:
1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断
select * from people
where peopleId in (
select peopleId from people
group by peopleId having count(peopleId) > 1)
2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录
delete from people
where peopleId in (
select peopleId from people group by peopleId having count(peopleId) > 1)
and rowid not in (select min(rowid) from people
group by peopleId having count(peopleId)>1)
3、查找表中多余的重复记录(多个字段)
select * from vitae a
where (a.peopleId,a.seq) in (
select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
4、删除表中多余的重复记录(多个字段),只留有rowid最小的记录
delete from vitae a
where (a.peopleId,a.seq) in (
select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae
group by peopleId,seq having count(*)>1)
5.获取前多少条数据:
mysql: Limit param1,param2 (param1 从哪里开始;param2 长度)
oracle: ROWNUM <= 10
6.JDBC的java连接配置关键代码。
//1.加载驱动程序
Class.forName("com.mysql.jdbc.Driver");
//2.获得数据库链接
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
7.怎么理解spring mvc中的mvc。
人机 > Controller(控制器) > 对应Model(模型) > view(视图) > 人机
8.字符串abcdfg,java程序输出倒序为gfdcba。
public static void main(String[] args) {
String str = new String("abcdefgh");
System.out.println(reverseStr(str));
}
public static String reverseStr(String str) {
return (new StringBuffer(str).reverse().toString());
}
⚠️:stringBuffer倒序函数:.reverse()。
9.jquery一排单选按钮,输出单选按钮选择的第几个。
$("input[name='xxx']:checked").val()
10.写一个单例模式。
public class SingleObject {
//新建一个单例对象
private static SingleObject instance = new SingleObject();
//private的构造方法,不会被初始化
private SingleObject() {};
//对象的get方法
public static SingleObject getInstance() {
return instance;
}
public void showMessage() {
System.out.println("这是一个单例模式");
}
}