“Auto increment” alphabet in Java?

后端 未结 10 2187
情书的邮戳
情书的邮戳 2020-12-02 16:53

\"Auto increment\" alphabet in Java - is this possible? From A to Z without a third-party library?

10条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 17:22

    Mandatory Java 8 solution:

    IntStream.rangeClosed('A', 'Z')
             .mapToObj(c -> "" + (char) c)
             .forEach(System.out::println);
    

提交回复
热议问题