日期:2014-05-20  浏览次数:20574 次

求助:java作业题
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. 取得输入的行是不是空的,用String.isEmpty()判断,如果是空行,则退出while 循环
2. 把非空的行存入一个List
3. 输出List中的行