Hi all,,
how can i ignore the comment statements that begin with "/* " and ends with
" * / "
for example: /* the class is/
or
/ problem is
very difficult */
i want to remove these statement when i reading java file line by line
package filename1;
public class filename1{
public static void main(String[]argv) throws ClassFormatException, IOException {
try {
fileName = "C:\\NetBeansProjects\\filename\\src\\filename\\filename.java";
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
line = br.readLine();
while (line !=null) {
for( int i=0;i<line.length();i++)
{
b=line.indexOf("/",i);
ee=line.indexOf("*",i);
if(b!=-1 && ee!=-1)
v=line.indexOf("*/",i);
if (v==-1 )
line=" ";
}
System.out.println(line);
line = br.readLine();
}
}
catch (IOException e) {
e.printStackTrace();
}}}
...can anyone help me >>whats wrong in my program??