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