Beginner Level
These exercises and questions target programmers who are new to Java. They focus on the basic building blocks of Java's syntax e.g., data types, loops, conditions, arrays, methods, objects, and so on.
Common Runtime Error
See if you can debug a piece of code that produces one of the most fundamental Java runtime errors.
See if you can debug a piece of code that produces one of the most fundamental Java runtime errors.
Playing With Wrappers
Play around with wrapper classes in this simple exercise.
Play around with wrapper classes in this simple exercise.
Literal Loop
Can you write loops using hexadecimal and octal literals?
Can you write loops using hexadecimal and octal literals?
Converting Strings
Test your ability to convert Strings to numbers.
Test your ability to convert Strings to numbers.
Counting Rabbits
Here's a idealistic way for counting rabbits can you determine how many will exist after 20 generations?
Here's a idealistic way for counting rabbits can you determine how many will exist after 20 generations?
The Infinite Loop
Can you rewrite this Java code so that there is no longer an infinite loop?
Can you rewrite this Java code so that there is no longer an infinite loop?
Breaking Out
Are you a fan of jumping out of loops? If so, where do you land after breaking out?
Are you a fan of jumping out of loops? If so, where do you land after breaking out?
The Hailstone Sequence
A clever German mathematician created a simple formula that will produce what is sometimes known as the hailstone sequence. Can you write a program to display that sequence for a certain number?
A clever German mathematician created a simple formula that will produce what is sometimes known as the hailstone sequence. Can you write a program to display that sequence for a certain number?
Shifting Bits
How are you at shifting bits right and left?
How are you at shifting bits right and left?
Code Points
Try and discover which characters are represented by the Unicode code points.
Try and discover which characters are represented by the Unicode code points.
Code Points (Part II)
Explore the characters produced by code points beyond the lower ranges.
Explore the characters produced by code points beyond the lower ranges.
Encoded First Line
I have cunningly encoded a first line from an Iain Banks book. Can you write a program to decode it?
I have cunningly encoded a first line from an Iain Banks book. Can you write a program to decode it?
Uncoded Line
This time rather than decoding a line, it's time to encode one.
This time rather than decoding a line, it's time to encode one.
The Collatz Theory
The hailstone sequence is back again. This program is designed to test Lothar Collatz's unproven theory.
The hailstone sequence is back again. This program is designed to test Lothar Collatz's unproven theory.
Going Around and Around
Have you ever wanted to put your programs into a spin? Here's your chance.
Have you ever wanted to put your programs into a spin? Here's your chance.
Odd Magic Squares
Turtles, magic and squares will conspire to test your logic in this exercise.
Turtles, magic and squares will conspire to test your logic in this exercise.
Doubly-Even Magic Squares
Take the odd magic squares program one step further with another test of your programming logic.
Take the odd magic squares program one step further with another test of your programming logic.
Build a Simple Robocode Robot
It's time for some robot carnage.
It's time for some robot carnage.
