Lets say I have a string = "hello". how do i open a text file and check if hello exists in that text file?
contents of the text file:
hello:man:yeah
i tried using the code below. Is it file reader only reads the first line? i need it to check all lines to see if hello exists, and then if it does, take "man" from it.
try {
    BufferedReader in = new BufferedReader(new FileReader("hello.txt"));
    String str;
    while ((str = in.readLine()) != null) {
        System.out.println(str);
    }
} catch (IOException e) {
    System.out.println("Error.");
}
 
     
     
     
     
    