You are requested to output what you got from the system console.
 
Input: A line of string, until no inut is found!  Example: 
This is the first line.
This is the second line.
...
This is the end.
 
Output: What you get from the console(keyboard)
This is the first line.
This is the second line.
...
This is the end.
 
Hints:
 
On getting input from the console, you can refer to the article. For reading a line from the console, here is a example:
 Scanner s = new Scanner(System.in);
if (s.hasNextLine()) {
      String line = s.nextLine();
      ......
}

解决方案 »

  1.   

    1. 取得输入的行是不是空的,用String.isEmpty()判断,如果是空行,则退出while 循环
    2. 把非空的行存入一个List
    3. 输出List中的行
      

  2.   

    [Quote=引用 5 楼  的回复:]
    引用 1 楼 的回复:1. 取得输入的行是不是空的,用String.isEmpty()判断,如果是空行,则退出while 循环
    2. 把非空的行存入一个List
    3. 输出List中的行对古云山大uifhl;空间的
     sdfgdf
      

  3.   


    + 167765087 Java开发技术交流
      

  4.   

    好吧,我只想说这道题歧义太大了
    我们都理解错了
     import java.util.Scanner;  
     class Main{  
         public static void main(String[] args) {  
               
         Scanner s =new Scanner(System.in);  
       
        while (true)  
        {  
            if(s.hasNextLine()){  
         String string =s.nextLine();  
         System.out.println(string);  
            }  
            else{  
                break;  
            }  
        }  
       
       }  
     }