0
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!

2
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by NormR1
1

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.