Questions

Java questions

Choose a question page, learn the concept, then test your understanding with a quiz.

How to Link to a Method in JavaDoc with @link in Java

Learn how to reference methods in JavaDoc using the @link tag, including correct syntax, examples, overloads, and common mistakes.

javahyperlinkjavadoc

How to Measure Method Execution Time in Java

Learn how to time method execution in Java using System.nanoTime, currentTimeMillis, and practical benchmarking tips.

javatimingexecution-time

How to Mock Void Methods with Mockito in Java

Learn how to mock and verify void methods with Mockito in Java, including doNothing, doThrow, doAnswer, and observer-style testing.

javaunit-testingmockingmockito

How to Parse JSON in Java

Learn how to parse JSON in Java and extract nested object and array values like pageName, pagePic, and post_id with clear examples.

javajsonparsing

How to Place the Cursor at the End of an EditText in Android

Learn how to move the cursor to the end of text in an Android EditText after changing its value programmatically.

javaandroidkotlinandroid-edittext

How to Print a Java Array: Arrays.toString() and Arrays.deepToString()

Learn the simplest way to print Java arrays using Arrays.toString() and Arrays.deepToString() with clear examples for beginners.

javaarraysprintingtostring

How to Read a File into a String in Java

Learn how to read an entire file into a String in Java, including modern approaches, encoding choices, examples, and common mistakes.

javastringfilefile-io

How to Read a Large Text File Line by Line in Java

Learn how to read very large text files line by line in Java using BufferedReader and NIO, with examples, pitfalls, and best practices.

javaperformancefile-ioio

How to Remove Items While Iterating a Collection in Java Without ConcurrentModificationException

Learn why ConcurrentModificationException happens in Java and how to safely remove items from a Collection while iterating.

javacollectionsiteration

How to Round to N Decimal Places in Java with Half-Up and No Trailing Zeros

Learn how to round numbers in Java using HALF_UP and remove trailing zeros with DecimalFormat and BigDecimal.

javadecimalroundingdigits

How to Sort a Map by Value in Java

Learn how to sort a Java Map by value using comparators, streams, and LinkedHashMap, with examples, pitfalls, and a mini project.

javasortingdictionarycollections

How to Sort an ArrayList of Custom Objects by Date in Java

Learn how to sort an ArrayList of custom objects by a Date property in Java using Comparator, compare, and Collections.sort().

javasortingdatecomparator

How to Split a String in Java Using a Delimiter

Learn how to split a string in Java with a delimiter, check whether a delimiter exists, and safely access the parts with examples.

javastringsplit

How to Use java.net.URLConnection for HTTP Requests in Java

Learn how to use java.net.URLConnection and HttpURLConnection in Java for GET, POST, headers, forms, cookies, and responses.

javahttphttprequesthttpurlconnection

Including All JARs in the Java Classpath

Learn how Java classpath wildcards work, how to include all JARs in a folder, and why `lib/*.jar` may fail in some cases.

javacommand-lineclasspath

Is Java Pass-by-Reference or Pass-by-Value? A Clear Beginner Guide

Learn whether Java is pass-by-reference or pass-by-value, how object references work, and why method arguments behave the way they do.

javamethodsparameter-passingpass-by-reference

JDK vs JRE in Java: Differences, Roles, and When to Use Each

Learn the difference between JDK and JRE in Java, what each includes, and when developers use one or the other in real projects.

java

JVM Heap Size Explained: What -Xms and -Xmx Mean in Java

Learn what JVM -Xms and -Xmx mean, how they control heap memory, typical defaults, and how to use them safely in Java apps.

javamemory-managementparametersjvm

Java 8 Method References: Understanding the :: Operator and Math::max

Learn how Java 8 method references work, including :: syntax, functional interfaces, and why Math::max fits IntBinaryOperator.

javajava-8method-reference

Java Access Modifiers Explained: public, protected, package-private, and private

Learn the differences between Java access modifiers and when to use public, protected, package-private, and private in classes and inheritance.

javaprivatepublicprotected

Page 4 of 6 - 117 questions