Ok I am trying to write a program that when ran, will Println all the lines in a specific file (ss.txt). while println-ing, f textline is ever a certain name "william", it will also println "xxxxxxxx" (so that I can find that specific name when I look at the list ).
I run my program and it traverses the file and prints that lines correctly but it never does anything once it gets to the "william" name.
here is my code:
import java.io.*;
public class ReadFile
{
public static void main(String[] args)
{
try
{
FileReader file = new FileReader("data/ss.txt");
BufferedReader buffer=new BufferedReader (file);
String textline = null;
while((textline = buffer.readLine()) !=null)
System.out.println(textline);
if (textline = "William") System.out.println("xxxxxx");
buffer.close();
}
catch (IOException e) { System.out.println(e);}
}
}
Thanks
JN