Closing System.in

[code]
Reader rdr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(rdr);
String s;
s=br.readLine();
br.close();
Scanner sc=new Scanner(System.in);
s=sc.nextLine();
System.out.print(s);[/code]

I've noticed that if I close the BufferedReader, I won't be able to insert input from the keyboard anymore, as System.in is somehow closed. Is there anyway I can keep br.close() (I need that in order to delete a file) and then add more input from the keyboard?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories