Try this (https://teamtreehouse.com/library/practice-input-and-output-in-java) practice workshop. Here's the list of practice Java workshops (https://teamtreehouse.com/library/topic:java/type:practice) Answer from Alexander Davison on teamtreehouse.com
🌐
CodingBat
codingbat.com › java
CodingBat Java
CodingBat code practice · Welcome to Codingbat. See help for the latest. Java Example Solution Code · Java String Introduction (video) Java Substring v2 (video) Java String Equals and Loops · Java String indexOf and Parsing · Java If and Boolean Logic · If Boolean Logic Example Solution Code 1 (video) If Boolean Logic Example Solution Code 2 (video) Java For and While Loops ·
Python
CodingBat code practice · Welcome to Codingbat. See help for the latest. Python Example Code · Python Strings · Python Lists · Python If Boolean · Code Badges ·
CodingBat Python Warmup-1 sleep_in
The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in · sleep_in(False, False) → True sleep_in(True, False) → False sleep_in(False, True) → True
Python Example Code
CodingBat.com code practice.
Java Example Solution Code
The examples are geared to help with the CodingBat java coding problems.
🌐
CodeChef
codechef.com › practice › java
Practice Java
Complete your Java coding practice with our online Java practice course on CodeChef. Solve over 180 coding problems and challenges to get better at Java.
Discussions

Java Basics - Extra Practice Problems?
Devon Johnson is having issues with: Hi, Does anyone know if a place to find extra practice problems for each topic covered in the Java Basics course? I'd like a way to chal... More on teamtreehouse.com
🌐 teamtreehouse.com
1
May 22, 2018
Java Practice: Someone give me basic problems!
There are a few sites that are basically just coding challenges in various languages here are some java specific links: https://codingbat.com/java https://www.hackerrank.com/domains/java https://www.codewars.com/collections/java-challenges More on reddit.com
🌐 r/javahelp
9
3
February 6, 2023
Project to practice concurrency in Java
https://www.reddit.com/r/learnjava/comments/j8x9vv/what_are_some_not_very_complex_but_interesting/ More on reddit.com
🌐 r/learnjava
4
22
January 28, 2020
Best practice for mocking a ResultSet?
Don't. This is not what mocking is for. Rule #1 of mocking is do not mock interfaces you do not own. Why are you using the ResultSet? Let's say that you have a program that needs to get some widget counts, and those widget counts are obtained by running a query on the database. You iterate over the ResultSet and return a list of counts. Now you want to write a unit test. Since the ResultSet is at the boundary between the application and the database, and since you can't actually run the query, this is the natural thing you might want to mock. This is the wrong intuition. Rather, look at it from the program's perspective. All I really want is a count of widgets, but I don't know how to get that myself. So, instead of specifying all the details of how to ask a database for the answer, create an interface that simply asks the question. Whoever can answer the question will implement the interface. I don't care how the question is answered. interface WidgetRepository { List getWidgetCounts(); } Now, provide the WidgetRepository as an argument: public class WidgetProcessor { private WidgetRepository repo; public WidgetProcessor(WidgetRepository repo) { this.repo = repo; } public void process() { for(int count : repo.getWidgetCount()) { // Do something with widget counts } } } So that, instead of mocking ResultSet, you mock WidgetRepository. Much, much easier. Later, you'll create something like JdbcWidgetRepository which knows how to use a ResultSet to answer the question. This class you do not test with a mock, but for real in an integration test. More on reddit.com
🌐 r/java
10
11
February 26, 2015
🌐
HackerRank
hackerrank.com › domains › java
Solve Java Code Challenges
Java (Intermediate) Problem Solving (Intermediate) Difficulty · Easy · Medium · Hard · Subdomains · Introduction · Strings · BigNumber · Data Structures · Object Oriented Programming · Exception Handling ·
🌐
w3resource
w3resource.com › java-exercises
Java programming Exercises, Practice, Solution - w3resource
This resource offers a total of 5356 Java Programming problems for practice.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-exercises
Java Exercises - Basic to Advanced Java Practice Programs with Solutions - GeeksforGeeks
October 9, 2025 - This Java exercise collection is designed to deepen your understanding of Java and refine your coding skills. The programs provide hands-on experience in solving real-world problems, reinforce key concepts, and help you master Java fundamentals, including variables, control statements, arrays, strings, methods, and object-oriented programming.
🌐
Exercism
exercism.org › tracks › java
Java on Exercism
Join Exercism’s Java Track for access to 155 exercises grouped into 26 Java Concepts, with automatic analysis of your code and personal mentoring, all 100% free.
Find elsewhere
🌐
CodeHS
codehs.com › practice › java › math
Java Practice Problems
Languages Java Javascript Python C++ SQL · Java Practice Problems · LEVEL 1 · Area of a Circle w/ Radius · Square a Double Type · Cube of a Number · Weight of a Car Carrier Trailer · Purchase Calculator ·
🌐
Programiz PRO
programiz.pro › community-challenges › java
Java Coding Challenges | Programiz PRO
Java Certification · DSA with Python · DSA with C++ Complexity Calculation · DSA Certification · Explore Projects · Get started with projects and learn to build real-world applications · Create a new project · Start from a blank playground and build anything you want · GUIDED PROJECTSView all · Simple Dice RollerBeginner · Build this classic game piece by piece by solving interactive problems ·
🌐
CodeSignal
codesignal.com › learn › courses › java-coding-practice-for-technical-interviews
Java Coding Practice for Technical Interviews
Strengthen your implementation and problem-solving skills in Java with this practice-heavy course.
🌐
Codedamn
codedamn.com › problem-list › java-practice-problems
Java Practice Problems
Practice Java online through hundrends of practice problems and coding questions on codedamn.
🌐
LeetCode
leetcode.com › problem-list › mmza0utr
JAVA QUESTIONS 50 - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
🌐
Great Learning
mygreatlearning.com › blog › java exercises
Java Practice Programs and Coding Questions for Beginners
September 4, 2025 - Work through 90 Java practice programs, coding questions, and online exercises to improve your programming skills.
🌐
W3Schools
w3schools.com › java › java_exercises.asp
Java Exercises
Variables Print Variables Multiple Variables Identifiers Constants (Final) Real-Life Examples Java Data Types
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-programming-interview-questions
Top Java Coding Interview Questions (With Answers) | DigitalOcean
April 17, 2025 - Here are some Java multithreading and concurrency coding challenges to help you practice and improve your skills: Challenge 1: Implement a thread-safe singleton class. Challenge 2: Write a program to demonstrate the use of synchronized blocks to achieve thread safety.
🌐
Codecademy
codecademy.com › home › 12 java code challenges for beginners
12 Java Code Challenges for Beginners
January 21, 2025 - Are you learning Java and looking for exercises to test your new skills? Try these 12 Java code challenges for beginners and put your Java knowledge to use.
🌐
Programiz
programiz.com › java-programming › examples
Java Examples | Programiz
The best way to learn Java programming is by practicing examples. The page contains examples on basic concepts of Java.
🌐
Codewars
codewars.com › collections › java-exercises-1
Java Coding Practice | Java Exercises | Java Programs For Practice | Codewars
Codewars is a community where you can learn and practice coding in Java. Solve coding exercises to improve your skills.
🌐
University of Washington
practiceit.cs.washington.edu
Practice-It, a web-based practice problem tool for computer science students
Practice-it is a web application to help you practice solving Java programming problems online.