Java Puzzles

Find all questions that can be asked as programming exercises in your next Java interview.

Related Tags

Tutorials

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.”

Java Programs to Calculate Factorial

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 …

Reverse a String in Java

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.

Java Puzzle – Check if a String contains All Alphabets

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 …

HiLo Guessing Game in Java

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.

Java – Create an Object without ‘new’ Keyword

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, …

Dead code and Unreachable code in Java

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.

About Us

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.