1.SpringBoot哪些注解可以用来创建Bean
@Compont @Controller @Service @Repository @Bean @Configuration
2.HashMap和ConcurrentHashMap区别
HashMap java.util包下,非线程安全
ConcurrentHashMap java.util.concurrent包下,线程安全
3.lambda表达式创建线程
new Thread( () -> System.out.println("xxx") ).start();
注:java8开始支持lambda表达时,java8之前:
new Thread(new Runnable() {
@Override
public void run() {
System.out.println("xxx");
}
}).start();
4.student、course查询每门课程学生的平均分
select cid,cname,avg(ifnull(s.score,0))
from course c
left join student s on c.cid=s.cid
group by c.cid,c.cname
5.二叉树任意一种遍历
void travel(Node node) {
if (node == null) {
return;
}
System.out.println(node.val);
travel(node.left);
travel(node.right);
}
ps:答案仅供参考。