Scanner怎么實(shí)現(xiàn)連續(xù)輸入?
java的Scanner類,可以實(shí)現(xiàn)控制臺(tái)連續(xù)的輸入。以下代碼僅供參考:
packagecom.dusd;importjava.util.Scanner;publicclassInputDemo{publicstaticvoidmain(String[]args){//TODOAuto-generatedmethodstubScannerscanner=newScanner(System.in);while(true){Strings=scanner.nextLine()
;System.out.println("你輸入的是:"+s);}}}