when the above code is executed then it is showing that m string is undefined, please tell how to modify a string ,which is taken as input

String m;
BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
            try {
                m = x.readLine();
            }
            catch (IOException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
        a--;}
    index=m.indexOf('a',2);

Where is the { to match the } on line 9?
Presumably its before line 1 somewhere, in which case the declaration of m in line 1 will go out of scope on line 9, which means there is no "m" defined at line 10.