From the course: Spring Boot 2.0 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Build a CommandLineRunner

Challenge: Build a CommandLineRunner

From the course: Spring Boot 2.0 Essential Training

Start my 1-month free trial

Challenge: Build a CommandLineRunner

(upbeat motivating music) - [Instructor] Now it's time for a Challenge exercise, and this one's going to be kind of fun because this is actually an interview question that I see asked a lot, especially for newer developers. You're going to be asked to implement a FizzBuzz using a command liner runner. Now FizzBuzz, again, is one of those common interview questions, but I'm going to explain to you the rules. So, again, you'll use a CommandLineRunner interface to implement this. You are going to print all numbers between one and 100. So start with one, the last number printed should be 100. If the number is divisible by three, print Fizz instead of the number. If the number is divisible by five, print Buzz instead of the number. Now, if the number is divisible by both, say 15, then you print FizzBuzz. And I've got a great solution for this, but I want to see yours first, so dig in.

Contents