• Post Reply Bookmark Topic Watch Topic
  • New Topic

Core java related  RSS feed

 
srikanth darbha
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys i have doubt if i have a file named "11" and the file contains the below data
if(true)
{
System.out.println("herere");

Now my doubt is to read the file and do the work of a compiler that is to compile and log the mistakes.

I have written the below code :-
package com.st.file;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;

public class FileRead {
public static void main(String [] args) throws Exception
{
boolean flag = true;
File f= new File("11");
f.createNewFile();
BufferedReader br = new BufferedReader(new FileReader("11"));
while (flag)
{
String sb= br.readLine();
if(sb!=null && sb.trim().length()>0)
{
sb.concat(sb);
flag= true;
System.out.println("sb===="+sb);
}
else
flag = false;
if(sb.contains("("))
{

}
}
}
}

Now anyone please tell me how to validate the syntax of the file.
 
asr chowdary
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

can you check the below link...It may helps you.

http://stackoverflow.com/questions/13971728/program-to-check-syntax-errors-and-automatically-provide-solutions


thanks :)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!