import java.awt.List;
import java.util.ArrayList;
import java.util.Scanner;
public class p78_11 {
public static void main(String[] args)
{
String str="";
int i;
Scanner r=new Scanner(System.in);
System.out.print("请输入多行字符串,以exit结束. ");
ArrayList<String> str_list=new ArrayList<String>();
while(!str.equals("exit"))
{
str=r.nextLine(); //输入字符串
str_list.add(str);
}
for(i=0;i<str_list.size();i++)
{
System.out.println(str_list.get(i));
}
r.close();
}
}
运行结果: