File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1352,7 +1352,8 @@ Throwable 可以用来表示任何可以作为异常抛出的类,分为两种
13521352- [ Java 入门之异常处理] ( https://www.tianmaying.com/tutorial/Java-Exception )
13531353- [ Java 异常的面试问题及答案 -Part 1] ( http://www.importnew.com/7383.html )
13541354
1355- # 九、泛型
1355+ # 九泛型
1356+ 类型的参数化,就是可以把类型像方法的参数那样传递。泛型使编译器可以在编译期间对类型进行检查以提高类型安全,减少运行时由于对象类型不匹配引发的异常。
13561357
13571358``` java
13581359public class Box <T> {
@@ -1366,13 +1367,23 @@ public class Box<T> {
13661367- [ Java 泛型详解] ( http://www.importnew.com/24029.html )
13671368- [ 10 道 Java 泛型面试题] ( https://cloud.tencent.com/developer/article/1033693 )
13681369
1369- # 十、注解
1370+ ## 为什么要引入泛型?泛型的引入解决了什么问题
1371+ * 在运行时做类型检查,保证了运行时的类型安全,避免了很多运行时的ClassCastException异常。
1372+
1373+ ## 有界泛型
1374+ <T extends Animal > // 限定T是Animal或Animal的子类
1375+ <T super Dog > // 限定T是Dog或Dog的超类
1376+
1377+ ## 泛型通配符
1378+ <? extends Animal> // 限定T是Animal或Animal的子类
1379+
1380+ # 十注解
13701381
13711382Java 注解是附加在代码中的一些元信息,用于一些工具在编译、运行时进行解析和使用,起到说明、配置的功能。注解不会也不能影响代码的实际逻辑,仅仅起到辅助性的作用。
13721383
13731384[注解 Annotation 实现原理与自定义注解例子](https://www.cnblogs.com/acm-bingzi/p/javaAnnotation.html)
13741385
1375- # 十一、特性
1386+ # 十一特性
13761387
13771388## Java 各版本的新特性
13781389
You can’t perform that action at this time.
0 commit comments