public class ReflectionTest {
@Test
public void testClassLoader() throws FileNotFoundException{
//src目录下,直接加载
InputStream in1 = null;
in1 = this.getClass().getClassLoader().getResourceAsStream("test1.txt");
//放在内部文件夹,要写全路径
InputStream in2 = null;
in2 = this.getClass().getClassLoader().getResourceAsStream("com/atguigu/java/fanshe/test2.txt");
}
}