Monday, August 25, 2014


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

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

Below are links to the answers to Deitel's Java How to Program (9th Edition) exercises that have been posted so far. This page is updated as more answers 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 us know. Only answers 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

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. its nice post. I got help from this post. Mr abid

    1. Hi Abid. Thanks. I'm glad you found it helpful.

    2. aby Chutia gand se pagal h kia custructor mai initialize krvadou

  2. 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?

    1. 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.

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

  3. thank u so much, u r super
    I'm glad to find these info

    1. please sir give us solutions of chapter 10 polymorphism

    2. Hi. I am very busy at the moment. I will post the solutions as soon as possible. Please do check back soon.

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

    1. Yes. I have solved it and added it to the list. You can check it out by clicking here.

  5. Anyone has solution to question 10.17?

  6. Does anyone have the solution for 17.11 on page 766 in excercises?

  7. does anyone have the solution for 18.20 in exercise qs

  8. What about Deitel 10th Edition? And after so much time it isn't finished the 9th Edition

  9. where is chapter 8 ..i have problems in chapter 8 exercise

  10. if any one has the solution of JAVA HOW TO PROGRAM 9TH EDITION please send me at

  11. Need help with this question please.

    Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram,
    Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Create and use a Point
    class to represent the points in each shape. Make the hierarchy as deep (i.e., as many levels) as possible.
    Specify the instance variables and methods for each class. The private instance variables of
    Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral.
    Write a program that instantiates objects of your classes and outputs each object’s area (except Quadrilateral).


DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately. To get notified of replies or follow-up comments, click the box next to notify me.