集册 Java实例教程 在for循环中使用两个计数器

在for循环中使用两个计数器

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

485
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
在for循环中使用两个计数器

public class CountBothWays

{

     public static void main(String[] args)

      {
      /** from 
      nowjava**/

           int a, b;

           for (a = 1, b = 10; a <= 10; a++, b--)

                System.out.println(a + " " + b);

      }


}