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();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
A BufferedReader is a decorator that decorates another reader. An InputStream isn’t a a reader. You need an InputStreamReader first.
In response to your comment, here’s the javadoc for readline:
readLine
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:
An example of declaring that the exception may be thrown: