Questions

Java questions

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

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

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

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

Java ArrayList Initialization in One Line

Learn how to initialize a Java ArrayList in one line, when to use Arrays.asList, List.of, and how mutability affects your code.

javacollectionsarraylistinitialization

Java Date Parsing and Time Zone Transitions: Why 1 Second Becomes 353 Seconds

Learn why Java parses 1927 dates strangely in Asia/Shanghai and how time zone history affects epoch milliseconds and date math.

javadatetimezone

Java Enum Comparison: Should You Use == or equals()?

Learn how to compare Java enum values correctly using == or equals(), with examples, null safety, pitfalls, and best practices.

javaenums

Java Inner Class vs Static Nested Class: Differences, Use Cases, and When to Choose Each

Learn the difference between Java inner classes and static nested classes, with examples, use cases, mistakes, and design guidance.

javainner-classesstatic-classes

Java Threads: implements Runnable vs extends Thread

Learn the difference between implements Runnable and extends Thread in Java, when to use each, and why Runnable is usually preferred.

javamultithreadingrunnableimplements

Java Unicode Escapes in Comments: Why Commented Code Can Still Execute

Learn why Java processes Unicode escapes before tokenizing, allowing sequences like \u000d in comments to affect code parsing.

javaunicodecomments

Spring @Component vs @Repository vs @Service: What's the Difference?

Learn the difference between Spring @Component, @Repository, and @Service, including behavior, purpose, and when each annotation should be used.

javaspringspring-mvcannotations

StringBuilder vs StringBuffer in Java: Differences and Performance

Learn the difference between StringBuilder and StringBuffer in Java, including thread safety, performance, and when to use each one.

javastringbuilderstringbuffer

Testing Classes with Private Methods, Fields, and Inner Classes in Java

Learn how to test Java classes with private methods, fields, or inner classes using JUnit without changing access modifiers.

javaunit-testingjunittdd

Understanding Android UserManager.isUserAGoat(): Joke API and Practical Lessons

Learn what Android UserManager.isUserAGoat() really is, why it exists, and what it teaches about reading Android APIs safely.

javaandroidusermanager

Understanding serialVersionUID in Java Serialization

Learn what serialVersionUID is in Java, why Serializable classes should define it, and how it prevents deserialization problems.

javaserializationserialversionuid

What "Could Not Find or Load Main Class" Means in Java

Learn what Java's "Could not find or load main class" error means, what causes it, and how to fix classpath, package, and main method issues.

javaclassprogram-entry-point

What Is Apache Camel in Java? Beginner-Friendly Introduction

Learn what Apache Camel is, how it works with Java applications, and whether it runs independently or inside a server.

javaapache-camelsoaenterprise-integration

What Is Reflection in Java and Why Is It Useful?

Learn what reflection is in Java, how it works, why it is useful, and when to avoid it with practical examples for beginners.

javareflectionterminology

What Is a JavaBean in Java? Properties, Getters/Setters, and Serializable Explained

Learn what a JavaBean is in Java, how it differs from a regular class, why the term exists, and what Serializable means.

javadependency-injectioninversion-of-controljavabeans

When to Use LinkedList vs ArrayList in Java

Learn when to use LinkedList or ArrayList in Java, how they differ in performance, and which List implementation fits common coding tasks.

javaarraylistcollectionslinked-list

Page 3 of 4 - 69 questions