Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
DSA
22.8K+ articles
Java
10.8K+ articles
Misc
8.8K+ articles
Competitive Programming
3.3K+ articles
Experienced
640+ articles
java-basics
330+ articles
Java-Output
54+ articles
Java-Data Types
28+ articles
Java-Operators
23+ articles
java-puzzle
11 posts
Recent Articles
Popular Articles
Java Ternary Operator Puzzle
Last Updated: 28 April 2025
In Java, the ternary operator is a simple way to perform conditional operations. It evaluates a condition and returns values depending on whether the condition is true or ...
read more
Java
Java-Operators
java-puzzle
Interesting interview question on hashCode and equals method
Last Updated: 25 September 2017
Prerequisite: Equal and Hashcode Methods in Java , Why to override equal and hashcode methods hashCode and equals method are frequently asked in Java interviews. In genera...
read more
Java
Hash
Experienced
DSA
java-puzzle
Experiences
Difference between x++ and x=x+1 in Java
Last Updated: 08 November 2022
In x++, it increase the value of x by 1 and in x=x+1 it also increase the value of x by 1. But the question is that both are same or there is any difference between them. ...
read more
Java
Competitive Programming
Difference Between
DSA
java-basics
java-puzzle
Infinite Loop Puzzles in Java
Last Updated: 05 May 2025
In Java, Infinite loops are a very important concept to understand. Infinite loops can occur due to various reasons such as overflows, unboxing and logic comparisons. In t...
read more
Java
Java-Output
java-puzzle
Assigning long values carefully in Java to avoid overflow
Last Updated: 07 December 2018
Predict the output of the following programJava public class LongDivision { public static void main(String[] args) { final long MICROS_PER_DAY = 24 * 60 *...
read more
Misc
Java
Java-Output
java-basics
Java-Data Types
java-puzzle
Java Chained Typecasting
Last Updated: 27 May 2025
In Java, typecasting between different data types plays a very important role, but it can also lead to unexpected errors, especially when we have to deal with signed and u...
read more
Java
Java-Data Types
java-puzzle
A Java Random and StringBuffer Puzzle
Last Updated: 20 October 2018
Predict the output of the programJava import java.util.Random;public class GFG { private static Random rd = new Random(); public static void main(String[...
read more
Java
Java-Strings
java-puzzle
java-StringBuffer
Java Function/Constructor Overloading Puzzle
Last Updated: 03 September 2018
Predict the output of the programJava public class GFG { private GFG(Object o) { System.out.println(Object); } private GFG(double[] d) { ...
read more
Misc
Java
Java-Constructors
java-puzzle
Java-Overloading
Executable Comments in Java
Last Updated: 11 November 2022
A comment is a statement that is not executed by the compiler or the interpreter, but before the lexical transformation of the program in the compiler, the contents of the...
read more
Java
Technical Scripter
java-puzzle
How to measure time taken by a function in java ?
Last Updated: 30 April 2024
We can measure the time taken by a function inJavawith the help of java.lang.System.nanoTime() and java.lang.System.currentTimeMills() methods. These methods return the cu...
read more
Java
java-puzzle
Few Tricky Programs in Java
Last Updated: 25 September 2017
Comments that execute : Till now, we were always taught "Comments do not Execute". Let us see today "The comments that execute"Following is the code snippet:Java ...
read more
Java
Technical Scripter
java-puzzle
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !