部分答案:
1.
$("#btn").click(function(){
var div = $("#div");
if ( div.css("display") === "none" ) {
div.show();
} else {
div.hide();
}
}
2.在jdk1.7以下版本,switch的参数类型只能是:int 或者 enum,在jdk1.7及以上版本,参数可以为String类型
3.
对于short s1 = 1; s1 = s1 + 1; 由于s1+1运算时会自动提升表达式的类型,所以结果是int型,再赋值给short类型s1时,编译器将报告需要强制转换类型的错误。对于short s1 = 1; s1 += 1;由于 += 是java语言规定的运算符,java编译器会对它进行特殊处理,因此可以正确编译。
4.
标号:(跳出的位置)
循环内:break 标号;
5.EexceptionA
6.
File file=new File("H:\\"); for(File temp:file.listFiles()){ if(temp.isDirectory()){ System.out.println(temp.toString()); } }
7.
饿汉式
class Singleton {
private static Singleton instance=new Singleton();
private Singleton(){}
static Singleton getInstance() {
return instance;
}
}
懒汉式
class Singleton {
private static Singleton instance=null;
private Singleton(){}
static Singleton getInstance() {
if(instance==null)
instance=new Singleton();
return instance;
}
}
8.
select year,
(select amount from aaa m where month=1 and m.year=aaa.year) as m1,
(select amount from aaa m where month=2 and m.year=aaa.year) as m2,
(select amount from aaa m where month=3 and m.year=aaa.year) as m3,
(select amount from aaa m where month=4 and m.year=aaa.year) as m4
from aaa group by year;
9.
public static void main(String[] args) throws Exception {
ArrayList<Student> list = new ArrayList<>();
list.add(new Student(1, 1, "学生1"));
list.add(new Student(2, 2, "学生2"));
list.add(new Student(3, 3, "学生3"));
list.add(new Student(4, 4, "学生4"));
list.add(new Student(5, 5, "学生5"));
list.add(new Student(6, 6, "学生6"));
list.add(new Student(7, 7, "学生7"));
list = removeEven(list);
System.out.println(list);
}
private static ArrayList<Student> removeEven(ArrayList<Student> list) {
Iterator<Student> iterator = list.iterator();
while(iterator.hasNext()){
if (iterator.next().studentNo%2==0) {
iterator.remove();
}
}
return list;
}
10.
一:include 动态包含(分别编译)
二:useBean动作(jsp页面使用javaBean的第二种方式)
三:getProperty动作(name为useBean动作中的id)
四:setProperty动作(name为useBean动作中的id)
五:param动作(传递参数))
六:forward动作(跳转页面)
七:plugin动作(用于指定在客户端运行的插件)
11、
jQuery使用document.ready来保证所要执行的代码是在DOM元素被加载完成的情况下执行。
可以简单理解为页面加载完成后执行 document ready内的代码。
12.本质上没区别。只是函数有如:只能返回一个变量的限制。而存储过程可以返回多个。而函数是可以嵌入在sql中使用的,可以在select中调用,而存储过程不行。执行的本质都一样。
13.
主键:ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) ;
唯一索引:ALTER TABLE `table_name` ADD UNIQUE ( `column`) ;
索引:ALTER TABLE `table_name` ADD INDEX index_name ( `column` ) ;
联合索引:ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` )
14.
小0大5,
小4大6,
小5大4,
小3大6
16.
static A
static B
I'm A class
Hello A
I 'm B class
Hello B