笔试题:
- 100*100px 图片 ARGB8888 bitmap大小?
- IntentService和Service的区别以及IntentService的应用场景?
- 手写二分查找?
- 这里有一个TreeNode类的例子,它调用了不同实例的synchronized方法:
public class TreeNode {
TreeNode parent = null;
List children = new ArrayList();
public synchronized void addChild(TreeNode child){
if(!this.children.contains(child)) {
this.children.add(child);
child.setParentOnly(this);
}
}
public synchronized void addChildOnly(TreeNode child){
if(!this.children.contains(child){
this.children.add(child);
}
}
public synchronized void setParent(TreeNode parent){
this.parent = parent;
parent.addChildOnly(this);
}
public synchronized void setParentOnly(TreeNode parent){
this.parent = parent;
}
}
Thread 1: parent.addChild(child); //locks parent
--> child.setParentOnly(parent);
Thread 2: child.setParent(parent); //locks child
--> parent.addChildOnly()
线程安全吗?
面试:
Handler
Glide
Okhttp
LruCache
应用的启动流程
网友评论