
hi,
please suggest me how to write the java code for reading a file and ignore the commented lines in /......../ this dispaly the contents of the file without commented lines.

import java.io.*;
class ReadFileIgnoringSomeLines
{
public static void main(String[] args) throws Exception
{
FileReader fr=new FileReader("data.txt");
BufferedReader br=new BufferedReader(fr);
StringBuffer buffer=new StringBuffer();
String str;
while((str=br.readLine())!=null){
if(str.contains("//")||str.contains("/*")||str.contains("*/") ){
continue;
}
else{
buffer.append(str);
buffer.append("\n");
}
}
System.out.println(buffer.toString());
}
}

hi, Thanka a lot for help. Another help I need, please help me solve this problem.
please suggest me how to extract table name and find the no of select statement and insert statement from a file and dispaly the result of SELECT and INSERT tablewise i.e.
abc_table SELECT 4
pgm_table INSERT 5
Please tell me how to do the coding for this.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.