Examples to FizzBuzz of Java8

Feb 10, 2014   #Java 

業務では未だJava6だし、Java7自体いつ導入されるか分からないし、Java8を本格的に使うようになるのはすごい先だと思うけど、 Java8を触っている時間がほとんどなくて、Lambdaの構文自体を忘れてしまいそうなので、ちょっとリハビリでFizzBuzzを書いた。

FizzBuzzとはこれのことです。

CODING HORROR:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

コードは下記になります。

Enjoy !