Once again, I was out there trying to find the neatest solution for reading a string from the IDE console. It turns out that the shortest piece of code that one can write to achieve this would be :
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; ... public static String getString() throws IOException { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {; return br.readLine(); } }
No comments:
Post a Comment
I have had so many good people trying to promote various community oriented sites through here. Therefore all comments will first have to come through me... so I get a chance to learn about the interesting sites before you do ...