Top 10 Popular and Tricky Java Puzzles (Worth Trying !!!)

Popular & Tricky Java Puzzles :

 

Article 1:

 

Boolean variables are the simplest.. They can just be True or False.

Can you predict what happens with the Boolean variables in this puzzle ?

Java Quiz 22 (Boolean states)

 

Article 2:

 

We have a collection here.. we add some elements to it and remove them. But the results are not as expected.

Can you explain why ?

Java Quiz 4 (Short Set)

 

Article 3:

 

This puzzle is about method overloading. Could you identify which overloaded method will be called here ?

Java Quiz 11 (Overloaded)

 

Article 4:

 

main() method is the entry point of a program in Java. But can a class call another class’s main() method ?? Find out in this quiz:

Java Quiz 15 (main() calling main())

 

Article 5:

 

For-each loop is a nice improvement over traditional for loop.

Test your understanding for this looping construct :

Java Quiz 14 (For Each)

 

Article 6:

 

Predict the output of this switch statement:

Java Quiz 23 ( Switch statement)

 

Article 7:

 

In java, its possible to create methods with varargs that can take  zero or more parameters.

How does method overloading behave when we have overloaded methods with variable arguments ?

Java Quiz 17 ( confusing overloading)

 

Article 8:

 

In what order are initializing blocks executed in Java ? Here is a quiz to test your understanding :

Java Quiz 29 (Order of initialization)

 

Article 9:

 

This quiz about Inner classes and what all they can access from the parent class or method:

Java Quiz 26 (Inner class access)

 

Article 10:

 

We use equals() method frequently for comparing objects.

How do they work on Strings and StringBuffers ? Test your understanding with this puzzle :

Java Quiz 30 (Strange Equality Test)

 

 

You may also like the following articles :

 

 

Thanks for visiting and all the valuable comments.

 

 

 java puzzles

© 2016 – 2017, https:. All rights reserved. On republishing this post, you must provide link to original post

Leave a Reply.. code can be added in <code> </code> tags