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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.