FizzBuzz Program in Java
In fizz buzz game, we say numbers such that if that number is a multiple of five, we say “fizz”, if multiple of seven, we say “buzz”, multiple of both, we say “fizzbuzz.”
Find all questions that can be asked as programming exercises in your next Java interview.
In fizz buzz game, we say numbers such that if that number is a multiple of five, we say “fizz”, if multiple of seven, we say “buzz”, multiple of both, we say “fizzbuzz.”
In this Java puzzle, we have a series of numbers and exactly one number is missing. We have to write a program to find the missing number.
We may be asked to write a program to calculate factorial during coding exercises in Java interviews. This always better to have an idea of how to build such a factorial program. 1. What is Factorial? The factorial of a number is the product of all positive descending integers up to …
Learn to write Java programs to reverse a String. Learn how to reverse the characters of a string and then how to reverse the words.
The given Java program uses a TreeMap to store the length of words as Map key, and all similar length strings in a List as Map value.
1. What is a Complete String? A string is said to be complete if it contains all the characters from a to z. If it misses even a single character, it is considered an incomplete string. For example, the following string is a complete string. It contains all the characters …
Good strings do not have the same consecutive letters. We simply need to perform one operation – if there are two same consecutive letters, delete one.
In HiLo game, we have to adjust our next guess such that we are able to guess the right number within six attempts. Learn with a Java program.
We can detect the infinite loop in a LinkedList using “Floyd’s Cycle-Finding Algorithm” or Hare and Tortoise approach.
Java palindrome example. Learn palindrome programs in Java using the reverse method, for loop and recursion methods.
We all know how to create objects of any class. The simplest method to create an object in Java is using new keyword. Let’s explore other methods to create objects without new keyword. 1. Using Class.newInstance() The Class.forName() loads the DemoClass in memory. To create an instance of this class, …
Learn to identify dead code and unreachable code in Java, with example. It may be asked in your Java interview coding problems as a puzzle. Let’s sovle it.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.