标签:ring str int java 然后将它逆序输出. ati scan string stat
输入五句话,用数组存储起来,然后逆序输出这五句话。
import java.util.Scanner;
class work1
{
public static void main(String[] args)
{
//System.out.println("Hello World!");
//数组-依次输入5句话,然后将它逆序输出.
Scanner input = new Scanner (System.in);
System.out.println("请输入5句话:");
String[] names = new String[5];
for(int i=0;i<names.length;i++){
System.out.print("第"+(i+1)+"句话:");
names[i]=input.next();
}
System.out.println("逆序输出的5句话为:");
for(int i=names.length-1;i>=0;i--){
System.out.println(names[i]);
}
}
}
标签:ring str int java 然后将它逆序输出. ati scan string stat
原文地址:http://www.cnblogs.com/future-zmy/p/6059785.html