Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3991142
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:34:46+00:00 2026-05-20T06:34:46+00:00

I want to know what’s wrong with this. it gives me a constructor error

  • 0

I want to know what’s wrong with this. it gives me a constructor error (java.io.InputSream)

BufferedReader br = new BufferedReader(System.in);
String filename = br.readLine();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:34:47+00:00Added an answer on May 20, 2026 at 6:34 am

    A BufferedReader is a decorator that decorates another reader. An InputStream isn’t a a reader. You need an InputStreamReader first.

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    

    In response to your comment, here’s the javadoc for readline:

    readLine

    public String readLine()
                    throws IOException
    
        Read a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
    
        Returns:
            A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached 
        Throws:
            IOException - If an I/O error occurs
    

    To handle this appropriately you need to either place the method call in a try/catch block or declare that it can be thrown.

    An example of using a try/catch block:

    BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    
    try{
        String filename = br.readLine();
    } catch (IOException ioe) {
        System.out.println("IO error");
        System.exit(1);
    } 
    

    An example of declaring that the exception may be thrown:

    void someMethod() throws IOException {
        BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
        String filename = br.readLine();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to know what is the wrong in this query I want to
I know this is a duplicate question. but i want know it with an
I'm a bit new to the C#-form app developing and I want know, what's
I've found an emulator for 80x86 created by using Java, and I want know,
i want to know about the difference in this two version Sql server 2008
Want to know what the stackoverflow community feels about the various free and non-free
I want to know what a virtual base class is and what it means.
I want to know what are the options to do some scripting jobs in
I want to know what exactly is the sequence of calls that occurs when
I want to know which tool can be used to measure the cyclomatic complexity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.