Class FizzBuzz
java.lang.Object
FizzBuzz
public class FizzBuzz
- extends java.lang.Object
FizzBuzz - an interview question which is said to weed out many weak
programmers.
See Fizz Buzz Test and
Using FizzBuzz to Find Developers who Grok Coding
Method Summary |
static java.lang.String |
fizzBuzz(int i)
Return the string representation of the parameter (e.g., for 1 return
"1"). |
static void |
main(java.lang.String[] args)
Write a program that prints the numbers from 1 to 100. |
fizzBuzz
public static java.lang.String fizzBuzz(int i)
- Return the string representation of the parameter (e.g., for 1 return
"1"). This can be generated by Integer.toString(i). But for multiples of
three return "Fizz" instead of the number and for the multiples of five
return "Buzz". For numbers which are multiples of both three and five
return "FizzBuzz".
Replace the throw statement with your implementation.
main
public static void main(java.lang.String[] args)
- 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".
You do not need to change this method.
Web Accessibility