集册 Java实例教程 使用参数索引重新排序输出。

使用参数索引重新排序输出。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

472
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用参数索引重新排序输出。

public class Main 
/**
 from
* NowJava.com - 时  代  Java 
**/

{

   public static void main(String[] args) 

   {

      System.out.printf(

         "Parameter list without reordering: %s %s %s %s\n", 

         "first", "second", "third", "fourth");

      System.out.printf(

         "Parameter list after reordering: %4$s %3$s %2$s %1$s\n", 

         "first", "second", "third", "fourth");      

   } 

}