@HUST-SuWB
2015-05-17T08:58:08.000000Z
字数 8235
阅读 364
读书笔记
【Eckel B, 陈昊鹏. Java 编程思想[J]. 2005.】
【注1】
类型 | 大小 | 包装器类 |
---|---|---|
boolean | Boolean | |
char | 16bit | Character |
byte | 8bit | Byte |
short | 16bit | Short |
int | 32bit | Integer |
long | 64bit | Long |
float | 32bit | Float |
double | 64bit | Double |
void | void |
【注2】
int x = 12;
{
int y = 9;
...
}//y已经消失
{
String s = new String("a");
...
}//虽然s消失了,但是s指向的对象仍然存在于内存中等待被回收
【注3】
名称 | 范围 |
---|---|
public | 全局 |
protected | 本包及子类 |
default | 本包 |
private | 本类内 |
【注4】
List | ArrayList | 可变数组;保持插入顺序;可重复 |
---|---|---|
LinkedList | 可变链表;保持插入顺序;可重复 | |
Set | HashSet | 元素不重复;存储方式很复杂,可以最快获取元素;插入顺序无意义 |
TreeSet | 元素不重复;升序存储 | |
LinkedHashSet | 元素不重复;保持插入顺序 | |
Map | HashMap | 存储方式很复杂,可以最快获取元素;插入顺序无意义 |
TreeMap | 升序存储 | |
LinkedHashMap | 保持插入顺序;保留HashMap的查询速度 |
【注5】
public void e(){
try{
throw new Exception();
}catch (Exception e){
for(StackElement ste : e.getStackTrace()){
Syste,.out.println(ste.getMethodName());
}
}
}
【注6】
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(s);//Matcher对象可以通过m.reset()重置
【注7】
死锁发生的四个条件: