1.抽象类为什么不能创建对象
- 抽象类拥有至少一个抽象方法,被abstract关键字修饰,不能直接实例化。
- 抽象类是不完整的,它只能用作基类。在面向对象方法中,抽象类主要用来进行类型隐藏和充当全局变量的角色。
- 抽象类相当于方法的声明而不是实现,抽象方法没有具体的实现语句,所以不能创建对象。
2.SQL查询语句关键字的执行顺序
- from where group by having select order by(从左往右执行)
3.Statement和PreparedStatement的区别
- PreparedStatement是预编译的,批量处理时效率提高,同时阻止了SQL注入,提高了安全性。
- PreparedStatement 对象的开销比Statement大,对于一次性操作的不如使用Statament好。
4.JavaBean和PreparedStatement
employee.java
package Bean.pojo;
public class Employee {
private String id;
private String username;
private double salary;
private int age;
private String depart;
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getUsername() { return username; }
public void setUsername(String username) { this.username = username; }
public double getSalary() { return salary; }
public void setSalary(double salary) { this.salary = salary; }
public int getAge() { return age; }
public void setAge(int age) { this.age = age; }
public String getDepart() { return depart; }
public void setDepart(String depart) { this.depart = depar