控制台输入字符串, 字符串中可能含有换行符和制表符,比如输入:
currently,two versions of the CLDC specification are avilable:
CLDC 1.0
CLDC 1.1
然后输出形式为:
currently,two versions of the CLDC specification are avilable:\n\tCLDC 1.0\n\tCLDC 1.1\n
控制台输入字符串, 字符串中可能含有换行符和制表符,比如输入:
currently,two versions of the CLDC specification are avilable:
CLDC 1.0
CLDC 1.1
然后输出形式为:
currently,two versions of the CLDC specification are avilable:\n\tCLDC 1.0\n\tCLDC 1.1\n
这个应该能帮到你,他不是用scanner是直接用输入流的方式获取控制台输入,然后自己定义结束符,我测过了可以用,按照这思路改改就行
或者你非要用scanner的话,可以写个while循环,如果不是你自己定义的结束符的话,就一直调用scanner.nextline,然后前后字符串用过\n拼接起来
https://zhidao.baidu.com/question/623587659028528732.html