Learn Java the Hard Way

Really learn the basics of programming with Java

“Learn Java the Hard Way” is a book with tutorial videos that teaches you how to code the same way a lot of us learned as children in the 1980s: typing in short, simple programs and getting them to work.

The exercises and explanations in this book are distilled from my nearly two decades of experience teaching programming to ordinary students. Over 2,000 students have taken my classes and nine months later almost all of them knew how to code — at least a little!

If you have ever bought another Java book for “beginners” and been lost by page 10, then my book is for you.

Your book will be available as a download in PDF, Kindle (.mobi) and iPad (.epub) versions so you can read it on all of your favorite devices. Videos are DRM-free, HD-quality MP4.

Customer Comments

Praise for “Learn Java the Hard Way”

  • Thank you!

    Hey there! I just wanted to shoot you a quick message (all the way from The Netherlands). I’ve just finished your Java book, and it was wonderful. Seriously, thank you. Best [money] I’ve ever spent.

    You really got me hooked on this programming business!

    Yuval Toledano
  • Java Programming… thank you!

    I can’t thank you enough for taking the time to write Learn Java the Hard Way. I’ve always wanted to learn programming, but just never had the time or funds to go to school for it. I’ve tried various online courses, but not one of them took the time to explain why you typed what you did. All of them said “Use Eclipse!”. I haven’t finished one of them because I spent the majority of my time googling answers to my questions. I was confused and frustrated, then I found your book in a Google search.

    It’s like you know what questions are going to be asked, and if the answers aren’t in the book, I can watch the videos and find them.

    Diane Egan
  • quite possibly the greatest

    Thank you very much your book is quite possibly the greatest intro to programming I have ever read - I have tried and failed many times to learn programming but now I feel I can actually do this - your videos are fabulous also.

    Chris Hudson
  • Thanks for LJtHW

    A week ago I started reading Learn Java the Hard Way seriously. I’d had programming experience before (with Python and bits of other languages), and was practising as a hobbyist Web Dev. [Other books] didn’t click with me; unfortunately I found that although I understood most programming concepts, the other materials were either too dry and boring or aimed at someone miles above me. I finally out of desperation resorted to your book.

    This book has literally been exactly what I was looking for - simply written but well explained. I’m only up to exercise 7 but already feel like I’ve learnt a lot.

    Matt
  • Thank You for LearnJavaTheHardWay

    I just wanted to thank you for your course. I have been trying to learn Java for over a year now and by far your course is the best.

    Matt Comstock
  • Thanks!

    I’d just like to take the effort to thank you for your work writing the LJTHW book.

    I “studied” and “passed” computer science about 20 years ago, and due to a bunch of circumstances didn’t end up following my then chosen career of programming. I’d always convinced myself that I would one day write a little 2D platformer game to scratch this itch, and now - with the help of your book, I am feeling like I fundamentally understand the essential basics and from there can progress to more complex subjects to achieve this goal.

    You’re the lecturer I never had - I’m convinced if you had taught me the way your book is teaching me, I would have been a programmer for the last 20 years, as was my dream.

    Mark Campbell

Get Started

The Complete Package
  • 244-page book in PDF, Kindle and iPad formats. Really learn the basics of programming with Java, even if other books have failed you.
  • Also includes my new book “Learn Object-Oriented Programming the Hard Way” which goes far beyond the basics in the same step-by-step way.
  • Java source code for all the example programs in both books
  • over 100 Study Drills (one or more per chapter) to test your understanding
  • hours of tutorial videos (one per chapter) that walk you through the concepts and the example programs in the first book
  • hours of answer videos that show you solutions to every Study Drill in the first book. Trying to solve a problem and comparing it to an expert solution really helps!
  • (Unfortunately there aren't any videos for my second book yet.)
The Original Book + Videos
  • 244-page book in PDF, Kindle and iPad formats. Really learn the basics of programming with Java, even if other books have failed you.
  • Java source code for all the example programs in the book
  • dozens of Study Drills (one or more per chapter) to test your understanding
  • hours of tutorial videos (one per chapter) that walk you through the concepts and the example programs
  • hours of answer videos that show you solutions to every Study Drill. Trying to solve a problem and comparing it to an expert solution really helps!
  • (but my excellent second book isn't included)
The Original Book
  • 244-page book in PDF, Kindle and iPad formats. Really learn the basics of programming with Java, even if other books have failed you.
  • Java source code for all the example programs in the book
  • dozens of Study Drills (one per chapter) to test your understanding
  • (but no videos)
Sample Book

If you're still undecided, you should read the first sixteen chapters for free on this site or I can email you a sample book containing just the free chapters and the first few videos:

What You Will Learn

Most books that claim to teach programming to “beginners” cover far too much material, far too quickly.

“Learn Java the Hard Way” covers just the basics of Java but it covers them deeply, with plenty of complete working examples and the explanations that the other books didn't even think to write down.

You won’t have a working Android app by chapter 5. But you will learn how to code, and you will understand every line of code that you are writing.

In the final chapter you’ll write a not-so-simple text-based adventure game with levels loaded from a file. You should also be able to write a text-based card game like Hearts or Spades.

  • Installing the Tools

    You’ll learn how to install a basic text editor, which you’ll use to write your programs. You’ll also learn how to install the Java compiler, which will convert your list of instructions into a form that the computer can execute.

  • Command-Line Basics

    You’ll learn the basics of navigating the command-line in Windows, Linux or Mac OS X.

  • How to Compile

    You’ll learn how to create, compile and run your first Java program. There's no magic here; you’ll learn and understand each step.

  • Variables

    You’ll learn how to use variables and how to get input from the person running your program.

  • File Input/Output

    You’ll learn how create programs that read data from text files and that write to files, too.

  • If Statements

    You’ll learn how to make decisions with if statements so that your program can behave differently depending on input.

  • Repeating Things with Loops

    You’ll learn how to repeat things using different types of loops, including the while loop, the do-while loop and the for and foreach loops.

  • Creating Procedures

    You’ll learn how to write functions (also called methods) to simplify commonly-repeated tasks.

  • Arrays

    You’ll learn how to combine native arrays and loops to deal with large amounts of data without having to write tons of code.

  • Records

    You’ll learn how to create basic records (also called objects) to make your code easier to understand.

About the Author

Teaching regular people to code since 1997.

2016 photo of the author -- Graham Mitchell
Hi, I'm Graham Mitchell!

I taught Computer Science at Leander High School (near Austin, TX) for twenty years (fall 1997–spring 2017). They are a pretty good school; consistently ranked near the top 5% of public schools nationally.

Most authors of “how to code” text books have never worked in the classroom or have only taught university students who are already majoring in Computer Science or who have quite a bit of prior experience. And although I have had a lot of exceptional students over the years, most of my students were regular kids with zero experience and no particular aptitude for programming.

I taught them to code, and I can teach you.

You should follow me on Twitter.

Frequently-Asked Questions

» What is included in the book?
The book is a DRM-free PDF. You can also download Kindle (.mobi) and iPad (.epub) versions if those are more your style. The book contains 59 exercises that walk you through creating programs and explaining what each line does. All the tools you need to create Java programs are included or freely available. Also included is a zip file containing all the source code and text files used in the book.
» What's different in the Second Edition?
In the second edition, every chapter has Study Drills. (In the first edition, most of the chapters had them but not all.) Also, the exercises have been improved based on two years of using these exercises with my real face-to-face students at Leander High School.
» Can I download a preview of the videos?
You can watch the first few videos on my Youtube playlist. If you just want to see if the videos will play on your computer, you can download the video for Exercise 1 (5.6 MB). If you request a sample book, some sample videos are included, too.
» What format are the videos in?
They are h.264 video at 1280 x 1024, 15 fps in an MP4 container. Audio is 64kbps AAC-LC. Please let me know if the videos don't play on your system.
» If I buy it now, will I get future updates for free?
Yes. Any future changes to the text are included for free. Also, if I add new answer videos or update the tutorials you’ll get an email to download the new version.
» I already bought the book! Can I buy just the videos?
Of course. Email me.
» Are you affiliated with Zed Shaw, who wrote the excellent book Learn Python the Hard Way?
No, but I have spoken to him on the phone. He knows about this project and has given it his blessing.
» Can I email you to get help?
Sure. Email graham@learnjavathehardway.org and I will do what I can.

“Learn Java the Hard Way” is ©2013– Graham Mitchell