Scanner doesn't work, makes a mistake.
-
The scanner makes a mistake:
java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\x{a0}][decimal separator=\x{2c}][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\Qне число\E][infinity string=\Q∞\E]
Code itself:
public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.toString(); System.out.print(s);
}
Eclipse development environment.
-
You're trying a class object.
Scanner
translatedString
♪ In order to extract information into the console, it is possible to write:public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); System.out.print(s);
}
That's your problem. https://ru.stackoverflow.com/questions/522589/%D0%9F%D1%80%D0%BE%D0%B1%D0%BB%D0%B5%D0%BC%D1%8B-%D1%81%D0%BE-scanner-%D0%B2%D1%8B%D0%B4%D0%B0%D0%B5%D1%82-%D0%BE%D1%88%D0%B8%D0%B1%D0%BA%D1%83 the commentaries have all been more detailed
https://javarush.ru/groups/posts/klass-scanner which makes it clear and detailed about how to work with the scanner, all the working methods necessary are described