141 lines
3.5 KiB
Markdown
141 lines
3.5 KiB
Markdown
<!-- GFM-TOC -->
|
|
* [????](#????)
|
|
* [ final](#-final)
|
|
* [????????](#????????)
|
|
* [???????](#???????)
|
|
* [????](#????)
|
|
* [Set](#set)
|
|
* [Queue](#queue)
|
|
* [Map](#map)
|
|
* [????](#????)
|
|
* [??](#??)
|
|
* [????????](#????????)
|
|
<!-- GFM-TOC -->
|
|
|
|
# ????
|
|
|
|
## final
|
|
|
|
**final ????**
|
|
|
|
??????????????????????????????????????????????????????????????????
|
|
|
|
????????????final ???????????????????final ???????????????????????????????????????????????????
|
|
|
|
**final ????**
|
|
|
|
????????????????????
|
|
|
|
private ?????????????? final????????????????????????????????? private ????????????????????????????????????????????????
|
|
|
|
**final ??**
|
|
|
|
???????????????
|
|
|
|
## ????????
|
|
|
|
static ??????????????????????????????????????????????????????????????????????????
|
|
|
|
```java
|
|
public static String staticField = "???????";
|
|
```
|
|
|
|
static ????? static ????????????????????????????????????????????????????????????????
|
|
|
|
```java
|
|
static {
|
|
System.out.println("??????????");
|
|
}
|
|
```
|
|
|
|
??????????????????????????????????????????????
|
|
|
|
```java
|
|
public String field = "????";
|
|
```
|
|
|
|
```java
|
|
{
|
|
System.out.println("???????");
|
|
}
|
|
```
|
|
|
|
???????????????????????????
|
|
|
|
```java
|
|
public InitialOrderTest()
|
|
{
|
|
System.out.println("??????");
|
|
}
|
|
```
|
|
|
|
?????????????????????????
|
|
|
|
1. ???????????????????
|
|
2. ???????????????????
|
|
3. ?????????????
|
|
4. ????????????
|
|
5. ?????????????
|
|
6. ????????????
|
|
|
|
## ???????
|
|
|
|
Java ???????????????????????private??protected ??? public????????????????????????????????
|
|
|
|
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
|
|
|
|
protected ???????????????????????????????????????????????????????????????????????????????????????
|
|
|
|
# ????
|
|
|
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/114c49a6-72e3-4264-ae07-c564127094ac.png)
|
|
|
|
??????????? Collection ?? Map ?????Collection ??????? List??Set ??? Queue??
|
|
|
|
## Set
|
|
|
|
- HashSet????? Hash ???????????????????????????
|
|
|
|
- TreeSet???????????????????????????????? HashSet??
|
|
|
|
- LinkedListHashSet?????? HashSet ????????????????????????????????????????????????
|
|
|
|
## Queue
|
|
|
|
???????????LinkedList ?? PriorityQueue?????? LinkedList ???????????
|
|
|
|
## Map
|
|
|
|
- HashMap????? Hash ???
|
|
|
|
- LinkedHashMap???????????????????????????????????LRU?????
|
|
|
|
- TreeMap?????????????
|
|
|
|
- ConcurrentHashMap??????? Map??????p???????
|
|
|
|
# ????
|
|
|
|
?????????? **Class** ???????????????????????????????????????????????????? .class ??????????????????? Class ????
|
|
|
|
????????? Class ?????????????????????????????? JVM ??????????? Class.forName('com.mysql.jdbc.Driver.class') ???????????????????????????????? Class ????
|
|
|
|
???????????????????????????????????????????????????????????????????? .class ???????????????????
|
|
|
|
Class ?? java.lang.reflect ???????????????java.lang.reflect ???????? **Field**??**Method** ??? **Constructor** ????????? get() ?? set() ???????????? Field ????????????????????? invoke() ?????????? Method ???????????????????? Constructor ??????????
|
|
|
|
IDE ????????????????????????????????????????????????????????????????????????????????
|
|
|
|
# ??
|
|
|
|
Throwable ??????????????????????????????????????**Error** ?? **Exception**?????? Error ??????????????????
|
|
|
|
Exception ????????**?????** ?? **???????**???????????? try...catch... ??????????????????????????????????????????????????????? 0 ?????? Arithmetic Exception???????????????????????
|
|
|
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/48f8f98e-8dfd-450d-8b5b-df4688f0d377.jpg)
|
|
|
|
# ????????
|
|
|
|
- Eckel B, ????? , ??? , ?? . Java ?????? [M]. ????????????? , 2002.
|
|
- [Java ????????? ](https://segmentfault.com/a/1190000004527951)
|