help: matches don`t work


function of code is putting if statement and discover do the if statement wrong or not
but the answer is always wrong, plz the help to get result when put the if correct statement is not wrong.
thank you

Java Code: import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; import java.util.regex.Pattern; public class Main { public static void main(String args[]) throws IOException { FileWriter fout = new FileWriter("test.txt"); fout.write("if a = 30 c = a / 5 ;"); fout.close(); FileReader fin = new FileReader("Test.txt"); Scanner src = new Scanner(fin); try { boolean z = Pattern.matches("if"+"[a-zA-Z]"+"="+"[0-9]"+"[a-zA-Z]"+"="+"[a-zA-Z]"+"/"+"[0-9]"+";",fin.getEncoding()); System.out.println("pattern is: "+z); } catch (Exception e) { System.out.println("error"); } fin.close(); } } mh_sh_highlight_all('java');
Posted On: Thursday 25th of October 2012 01:51:11 AM Total Views:  124
View Complete with Replies

RELATED TOPICS OF Java PROGRAMMING LANGUAGE