Questions
Java questions
Choose a question page, learn the concept, then test your understanding with a quiz.
Generate Random Integers in a Range in Java
Learn how to generate random integers within a specific range in Java correctly, avoid overflow bugs, and use Random and ThreadLocalRandom safely.
HashMap vs Hashtable in Java: Differences, Performance, and When to Use Each
Learn the differences between HashMap and Hashtable in Java, including thread safety, null handling, performance, and when to use each.
How to Avoid Null Checks in Java
Learn practical ways to avoid repeated null checks in Java, prevent NullPointerException, and write cleaner, safer code.
How to Convert an Array to an ArrayList in Java
Learn how to convert an array to an ArrayList in Java, including syntax, examples, common mistakes, and real project usage.
How to Convert an InputStream to a String in Java
Learn how to read a Java InputStream into a String safely using charset-aware techniques, examples, pitfalls, and best practices.
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.
Why Sorted Arrays Can Be Faster in C++: Branch Prediction Explained
Learn why looping over a sorted array can run much faster in C++ and Java, mainly due to CPU branch prediction and predictable control flow.