Hi, I have a question about the codes below, they both work, and give the wanted result but only the first one matches all the requirements, my question why? what is the difference between the first and second code? why better use the first form? Or better the second one? Please help! 1)
public static void main(String[] args) throws Exception {
       InputStream inputStream = System.in;
       Reader inputStreamReader = new InputStreamReader(inputStream);
       BufferedReader bufferedReader = new BufferedReader(inputStreamReader);

       String number = bufferedReader.readLine();
       String name = bufferedReader.readLine();

       System.out.println(name + " will take over the world in " + number +
               " years. Mwa-ha-ha" + "!");
2)
public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);

        String name = scanner.nextLine();
        String number = scanner.nextLine();

        System.out.println(name + " will take over the world in " + number +
                " years. Mwa-ha-ha" + "!");