标签:java-第七章-数组-依次输入5句话 然后将它逆序输出.
import java.util.Scanner; public class A01 { public static void main(String[] args) { // TODO Auto-generated method stub 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]); } } }
java-第七章-数组-依次输入5句话,然后将它逆序输出.,布布扣,bubuko.com
标签:java-第七章-数组-依次输入5句话 然后将它逆序输出.
原文地址:http://wenwen520.blog.51cto.com/8956560/1420978