Following is my Java code
import java.io.*;
public class UnderLine {
public static void main(String[] args) throws Exception {
String thisLine = null;
String Test = "Hello";
try {
// open input stream test.txt for reading purpose.
BufferedReader br = new BufferedReader(new FileReader("F:\\Java\\Testprojects\\UnderLine.java"));
while ((thisLine = br.readLine()) != null) {
if(thisLine==" String Test = \"Hello\";\n") {
// underLine the line which has String test
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
In the above code I read the same source code by giving its path. I want to underline (the red line coming under the words as if a normal code error occurs) the code line with
String Test = "Hello";.
How can I do it?