How To Read A Classpath File #589
How to read a classpath file?
This multiple choice question (MCQ) is related to the book/course gs gs128 Java. It can also be found in gs gs128 Exploring Java Lang Java IO - Java Environment Properties - Quiz No.1.
How to read a classpath file?
InputStream in = this.getClass().getResource(“SomeTextFile.txt”);
InputStream in = this.getClass().getResourceClasspath(“SomeTextFile.txt”);
InputStream in = this.getClass().getResourceAsStream(“SomeTextFile.txt”);
InputStream in = this.getClass().getResource(“classpath:/SomeTextFile.txt”);