I have a text file in the following format:
Details.txt
The file is a .txt file. I want to read course title from this file and print corresponding textbook
Use Scanner class
Scanner s=new Scanner(new File("C:/Details.txt")); while(s.hasNext()) { System.out.println(s.nextLine()); }
if you want in work by word then use String Tokenizer
see this article