Learn about Java topics with clear, step-by-step instructions developed by an experienced Java programmer.
Build your knowledge and confidence with easy-to-understand examples and plenty of skill-building exercises. So, whether you just want to try it out to see if you like it or plan on doing more with Java, this is a great place to start!
This course uses the latest release of Java, from Oracle, the company that maintains and supports the language. You will also learn how to use BlueJ, a graphical development environment designed especially for students. Both are free open-source products, and you will receive the proper instructions to download them. By the time you’re done, you will be comfortable with Java programming and ready for more!
- This course can be taken on either a PC or Mac.
- PC: Windows 8 or newer.
- Mac: OS X Snow Leopard 10.6 or later.
- Linux can also be used.
- Browser: The latest version of Google Chrome or Mozilla Firefox are preferred. Microsoft Edge and Safari are also compatible.
- The most recent versions of the Java Development Kit (JDK) and BlueJ. Download and installation instructions will be available in Lesson 4.
- Adobe Acrobat Reader. Click here to download the Acrobat Reader.
- Software must be installed and fully operational before the course begins.
- Email capabilities and access to a personal email account.
1 Introducing Java
Java is one of the most widely used programming languages in the world, on machines from microprocessors in DVRs and microwaves to supercomputers. This lesson will introduce you to computer programming in general and to Java in particular. First, you will be set up with the downloads and installations you will need for the rest of the course. Then, you will explore the process of editing, compiling, and running computer programs written in Java.
2 Writing Your First Java Program
Now that you have the software downloaded and installed, you're ready to start programming! It’s time to write your first Java program. Along the way, you will learn to create projects and classes in BlueJ. You will use the editor to enter your program, and you will find out more about how to compile it and run it.
3 Working With Java's Primitive Data Types
This lesson is about Java's primitive data types—the building blocks you need to use before you can build more complex types. First, you will learn how to use them in some simple programs and how they relate to each other. Beyond that, you will explore how to use these classes in the Java libraries.
4 Working With Objects
This lesson introduces classes and objects. You will revisit the HelloWorld application and rewrite it in Java's OOP (object-oriented programming) structure. While doing that, you will look at how to declare classes, objects, attributes, and methods to Java.
5 Creating a Program That Makes Calculations
This lesson covers how to declare data variables to Java and how to use variables in arithmetic expressions to calculate new results. You will learn about data input, which means getting information into programs from an outside source. Then you will write a program that incorporates all these features.
6 Computer Logic: Writing Programs That Make Decisions
Making decisions is one of the most important and powerful things a computer language can do. Without decision-making, computers would be big, bulky calculators. This lesson explores the decision-making process in detail and see how Java does it. When you're done with this lesson, you will know how to write Java programs that make decisions based on the principles of computer logic.
7 Writing Programs With Loops
In this lesson, you will learn to repeat actions using a control structure called a loop. Loops in Java involve decisions, just as branches do. But in a loop structure, if the condition is met, the branch is backward instead of forward.
8 Fixing Errors in Java
This lesson focuses on how Java generates exceptions and how to prevent them from crashing your programs. You will learn about class methods and how to call them without creating any objects. Last, you will find out about a debugger, which lets you look at what's going on inside the program as it runs.
9 Three Tools: Debugger, Enumeration, and Switch
This lesson is a grab bag of tools and topics. BlueJ's debugger lets you watch your program's internal actions as it runs. Enumeration lets you set up new data types with built-in limits on their values. Finally, Java's switch structure lets you replace a series of nested if statements with a single value-based structure. You will find all these items useful in future programming!
10 Formatting Output and the Java Application Program Interface
How can you make numbers and other output look the way you want them to in Java? This lesson looks at Java's application program interface (API). That's the documentation of all the classes that Java includes when you install the JDK, plus explanations of how to use them. The interface has several thousand classes, and it's important to know how to find things within it.
11 Creating Windows and Adding Graphics in Java
So far in this course, everything has been text-based. This lesson will introduce you to the world of Java windows, and you will look at GUI (graphical user interface) programming in Java. You will also learn about the basic components of a Java window and then add some simple graphics to it.
12 Java 2-D Animation
In your final lesson, you will continue exploring Java 2-D graphics with a look at some simple animation. You will use the same technique cartoonists have used for a hundred years now: redrawing an image in a slightly different location and repeating that process many times a second so the image appears to move. You will learn to create a self-contained object that "knows" its own size, color, shape, location, and how to draw itself into the window.