I now read Schildt, and there is very little written and incomprehensible about console input. Who can tell me how the Java version of this C ++ program will be:

cin >> string str; Cout << str; 

Cout I know, system.out.println (str); and how cin will be? Thanks in advance!

    2 answers 2

    Not everything is so simple in the world of java:

     BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String str = reader.readLine(); // Пример получения числа Integer intSample = Integer.parseInt(reader.readLine()); System.out.print(str); 

    In general, this is all in Google the first line.

       //считываем Scanner scanner=new Scanner(System.in); int value=scanner.nextInt(); //выводим System.out.println(value);