Hi All,
I am still on the continuing quest to improve my
Java by setting myself challenges to code. Today I was introduced to a simple numbers game called "FizzBuzz" which I have tried to capture in Java code.
The simple premise is to count through whole numbers from 1 to 100, printing them to the console. However, if the number is a multiple of 3 the
word "Fizz" is printed instead of that number. If the number is divisible by 5 then the word "Buzz" is printed in that numbers place. If the number is divisible by both 3 and 5 then the word "FizzBuzz" is printed.
For example:
1
2
Fizz
3
4
Buzz
.
.
.
14
FizzBuzz
16
I have completed my code in a class called FizzBuzz containing one void method called play() that doesn't take any arguments. Was wondering if anyone would care to try this simple task themselves and report back on their attempt. I have attached my code below but please attempt it yourself before looking at my solution. I would welcome any constructive criticism on my code as always as I find this is the best way to learn.