1.

How to read a classpath file?

A. InputStream in = this.getClass().getResource(“SomeTextFile.txt”);
B. InputStream in = this.getClass().getResourceClasspath(“SomeTextFile.txt”);
C. InputStream in = this.getClass().getResourceAsStream(“SomeTextFile.txt”);
D. InputStream in = this.getClass().getResource(“classpath:/SomeTextFile.txt”);
Answer» D. InputStream in = this.getClass().getResource(“classpath:/SomeTextFile.txt”);


Discussion

No Comment Found