首先来问大家一个问题:finally 语句块一定会执行吗? 很多人都认为 finally 语句块是肯定要执行的,其中也包括一些很有经验的 Java 程序员.可惜并不像大多人所认为的那样,对于这个问题,答案当然是否定的,我们先来看下面这个例子.清单 1. public class Test { public static void main(String[] args) { System.out .println("return value of test(): " + test ())…
前言 在Java中,反射机制和注解机制一直是一个很重要的概念,那么他们其中的原理是怎么样呢,我们不仅仅需要会使用,更要知其然而之所以然. 目录 反射机制 反射如何使用 注解定义 注解机制原理 注解如何使用 小结 反射机制 官网定义: Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running i…