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.
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
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
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
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
Videos
29:08
Java Tutorial: Practice Questions On Conditionals & Switch Case ...
10:36
Java Tutorial: Chapter 1- Practice Set | Java Practice Problems ...
25:49
Java tutorial: Practice Questions on Loops - YouTube
02:37:49
Dynamic Programming with Java – Learn to Solve Algorithmic Problems ...
15:35
Java Practice Programs For Beginners | Basic Java Programs | Java ...
13:54
Java Practice Questions on Strings: Practice Set on Java Strings ...
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.
Reddit
reddit.com › r/javahelp › java practice: someone give me basic problems!
r/javahelp on Reddit: Java Practice: Someone give me basic problems!
February 6, 2023 -
Hi there,
I am in the middle of Chapter 2 of my Intro to Java course.
I just completed the "Interest Rate Calculator" portion of the section.
I'm looking for examples (or formulas) to practice writing in Java.
I have already done Area of a Rectangular Prism, Area of a Hexagonal Prism, Wind Speed Calculation etc on my own. Does anyone have a nice source of practice examples that propose a problem for beginners? Or does anyone want to propose a problem example themselves?
Any and all help is appreciated!!!
Top answer 1 of 5
8
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
2 of 5
3
an interesting way of practicing loops is trying to print patterns on screen. something like: ----- ---- -- - or - --- ----- finding ways of printing patterns like these for any number of lines is pretty good for learning the capabilities of loops and developing logical thinking in general i guess. A good one to try and make could be /\ / \ / \ \ / \/ \/ this is suposed to be a diamond, i didn't know reddit made this with spaces
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.
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.
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.
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.