Learn Programming in Java

This is a self-paced short course designed to get eager, self-motivated people started in the skill of programming. Nobody learns programming in one or two weeks, it takes time and practice -- "motivation and miles" -- but we can give you a roadmap. Once you more or less understand the basic structure of things, you can look at existing programs and figure out how they work -- and by extension and a lot of copying, you can write your own code to do similar things.

When I first thought of this course, this was the first page, but then I though of an easier way to get started, the game Chomp, which by now you have already worked through. As a result, some of the first few "lessons" here in Java will be easy to understand. I would encourage you to read through it and play with some of the example programs anyway.

Java is similar in appearance to both C/C++ and JavaScript, so that switching to one of those languages, while not trivial, at least you understand the basic principles. Programming is a lot of work, and even more attention to detail, but you can do it if you want to. If you want life to be easy, find a different profession, but there's a lot of satisfaction in telling a computer what to do and seeing it do it.

Before you can program a computer, you need to be able to use it, that is, you need to be reasonably skillful at clicking and dragging and double-clicking and drag-selecting and copying and pasting and (of course) typing into fields in windows. You need recent a Windows (Win7 or later) or OSX (again, x.7 or later) computer to do this on. You could do it on Linux or an earlier computer, but it's harder; save that for after you get good at it (if you still want to). It also helps if you understand mathematical formulas and maybe a little algebra, but not much.

The most important requirement to be good at this is attention to detail. I call it "Observant, Careful, and Determined" and I thought an easy introduction to this way of thinking can be experienced by playing Chomp. I had a lot more introductory remarks, but they filled up my page with this massive gray sea of text, so I cut them out. I still rather like what I said, and I expect my remarks might be useful to you too, if you care to read them here.

OK, let's get started. Here are the topics we cover, in subsequent pages:

Tell the Computer What to Do, your first steps at controlling the computer (Chomp)
Begin 0: Telling the Computer What to Do
Begin 1: Remembering What You Told the Computer to Do
Begin 2: What You Can Tell the Computer to Do
Begin 3: What You Can Tell the Computer (Sequence and Iteration)
Begin 4: Tell the Computer in Numbers (and Variables)
Begin 5: Tell the Computer to Choose (Conditionals)
Begin 6: Tell the Computer to Build a Maze
Begin 7: Tell the Computer to Do Something then Come Back (Subroutines)
Begin 8: Tell the Computer What It Doesn't Know (Input) (Input and Output)
Begin 9: Telling the Computer in a Language
Introduction & Language
Lesson #0: Programming Environment
Lesson #1: Sequence & Output
Lesson #2: Variables & Expressions
Controlling Chomp from Java
Lesson #3: Conditionals & Input
Lesson #4: Iteration & Termination
Tic-Tac-Toe in Java
Lesson #5: Subroutines & Recursion
Lesson #6: Classes & Objects
Lesson #7: Extras

Next: Programming Environment

Updated: 2020 March 21