public class BufferedReader {

    public static void main(String[] args) 
    throws IOException
    {
        char c;
        BufferedReader sen  = new BufferedReader (new InputStreamReader(System.in)); **// ERROR**

        System.out.println("Enter characters, 'q' to quit");

        // read characters from the console
        while(c != 'q')
        {
            c = (char) sen.read(); **// ERROR**
            System.out.print(c);
        }
    }
}

I don't understand why the upper two lines of code produce error!

why the upper two lines of code produce error!

Please post the full text of the error message.

One problem is that your class has the same name as a Java SE class. Changing the name of your class should fix those errors.

Thank you, changing the class's name DID fix the problem.

Please mark as solved.

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.