Solutions to Deitel's Java How to Program (9th Edition) Exercises

Below are links to the solutions to Deitel’s Java How to Program (9th Edition) exercises that have been posted so far. This page is updated as more solutions to the exercises are posted. You are “STRONGLY ADVISED” to try to solve the problem first before checking the solution. Note that there are multiple ways of solving problems. That is to say, you may have another way (maybe even better) of solving the problem(s). In such case(s) please let me know. Only solutions to programs are provided here. Answers to self review exercises, multiple choice questions and theoretical questions are not provided. You can test run the programs online for free at or

Chapter Two

Exercise 2.14 – Program to display the numbers 1-4 on screen using different print methods
Exercise 2.15 – Java program to perform simple arithmetics
Exercise 2.16 – Program to compare two numbers using java
Exercise 2.17 – Arithmetic smallest and largest program in Java
Exercise 2.18 – Simple java program to display shapes with asterisks
Exercise 2.24 – Program to find the maximum and minimum of any five integer numbers
Exercise 2.25 – Program to check if a number is odd or even
Exercise 2.26 – Program to check if a number is a multiple of another number
Exercise 2.27 – Checkerboard pattern of asterisks
Exercise 2.28 – Program to calculate the diameter, circumference and area of a circle
Exercise 2.29 – Program to display the integer equivalent of characters
Exercise 2.30 – Program to separate digits in an integer
Exercise 2.31 – Java program to print table of squares and cubes
Exercise 2.32 – Program to count number of negative, positive and zeros input
Exercise 2.33 – Body Mass Index (BMI) Calculator in Java
Exercise 2.34 – Java world population growth calculator
Exercise 2.35 – Car-Pools savings calculator

Chapter Three

Exercise 3.11 – Java gradebook program using instance variables
Exercise 3.13 – Program to show how to use constructors in Java
Exercise 3.13 – Program to create invoice of items sold in a store
Exercise 3.14 – Program to calculate and display employee salary
Exercise 3.15 – Java Program to display date

Chapter Four

Exercise 4.1 – Java GUI and graphics case study exercise

Chapter Five

Exercise 5.32 – Facebook user base growth calculator


  1. Waiting for your 3rd and 4th chapter full exercise solution of this book.. Please post as fast as you can :(

  2. Anyone has solution to question 5.32? (making a difference section)

  3. Hi Mahdi, I don't know any website that offer the answers free. The answers are on the Pearson's website but it is only for "Instructors". You can also find the answers on chegg but it is not free. There is also an incomplete set of answers on github (its free though).

    The answers are posted here FREE and with explanations where necessary. This page is updated as new answers are posted. So, bookmark this page/add it to your favourite sites and check back often. I'll try and post the answers to the next few chapters as soon as possible.

  4. I do not have problems with the assignments although it takes me longer to solve some. I would like to know the answers to the exercise questions that do not have answers in the book. Do you know of any website that offers these answers?

Write A Comment