Here is my code, can anyone here help me?
import java.util.Scanner;
import java.lang.*;
public class ByteMonitor {
public ByteMonitor() {
}
public static void main(String[] args) {
Scanner scanner = null;
try {
scanner = new Scanner(new File("my_file.dat")); }
catch (FileNotFound ex) {
ex.printStackTrace(); }
Pattern file = Pattern.compile("x");
Matcher mfile = file.matcher("1001x000");
Matcher mfile = file.matcher("11111011");
Matcher m_2_file = file.matcher("00x00000");
Matcher m_3_file = file.matcher("00000000");
Matcher m_4_file = file.matcher("1001000x");
boolean x0 = mfile.matches();
boolean x1 = m1file.matches();
boolean x2 = m2file.matches();
boolean x3 = m3file.matches();
boolean x4 = m4file.matches();
System.out.println(scanner.nextLine());
}
}
-----------
I'm trying to get the result to print out this...
x
null
x
null
x
so if anyone here can edit and help me what I did wrong and fix my code, I would greatly appreciate it, thanks.