求標準java語言代碼?
代碼示例:
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畢業之后