Java for Complete Beginners (Video), Part 9: Switch
How to use the switch statement in Java; a construct that many programmers neglect but that invariably appears early on in tests and courses! When the video is running, click the maximize button in the lower-right-hand corner to make it … Continue reading
Java for Complete Beginners (Video), Part 8: Do … While
Do…while loops in Java, plus a look at variable scoping and multi-line comments. In this tutorial I tackle a task that’s often assigned to beginners on Java courses; looping until the user enters some particular input. When the video is … Continue reading
Java for Complete Beginners (Video), Part 7: Getting User Input
How to get console user input in your Java programs using the JDK Scanner class. When the video is running, click the maximize button in the lower-right-hand corner to make it full screen. Code for this tutorial: import java.util.Scanner; public … Continue reading
Java for Complete Beginners (Video), Part 6: If
A tutorial on the if() statement, plus some stuff on using break to break out of loops. When the video is running, click the maximize button in the lower-right-hand corner to make it full screen. Code for this tutorial: public … Continue reading
Java for Complete Beginners (Video), Part 5: For Loops
In the fifth part of the Java tutorial for beginners video series using Eclipse, we look using ‘for’ loops and printf(). Code for this tutorial: public class Application { public static void main(String[] args) { for(int i=0; i < 5; … Continue reading
Java for Complete Beginners (Video), Part 4: While Loops
In the fourth part of the Java tutorial for beginners video series using Eclipse, we look using loops to make your code repeat statements multiple times. We also take a look at conditions. Code for this tutorial: public class Application … Continue reading
Java for Complete Beginners (Video), Part 3: Strings
In the third part of the Java tutorial for beginners video series, we look at working with text using the String class. We also get our first real peek at using classes and objects. Code for this tutorial: public class … Continue reading
Java for Complete Beginners (Video), Part 2: Using Variables
In this second part of the Java tutorial for beginners series, we look at declaring and initializing variables — one of the most basic building blocks of any computer program. Code for this tutorial: public class Application { public static … Continue reading
Java for Complete Beginners (Video), Part 1: A Hello World Program
The first in a series of video tutorials on Java for absolute beginners, using the free Eclipse IDE. In this first video, I show you how to create a “hello world” Java program with a minimum of typing! Before you … Continue reading
Java for Beginners: Static Variables — What Are They?
What are static variable in Java, and what are they for? A static variable is one that’s associated with a class, not objects of that class. Let’s take a look at an example. To keep things as simple as possible, … Continue reading
Basic Java Programming: Test Your Knowledge
If you recently started learning Java and you want to improve your grasp of the basics, try the exercises below. They cover only the absolute basics and are suitable for beginners. Learn to program Java Swing with my complete video … Continue reading
Java Tutorial 8: Starting Threads and Using Anonymous Classes
A thread is a separate process on your computer; you can run multiple threads all at the same time. The way the CPU (central processing unit) actually handles this is usually by switching rapidly between threads to give the illusion … Continue reading
Java Tutorial 7: Exceptions
Exceptions in Java are used to deal with problems that arise during the execution of your program. They should only be used to deal with unexpected situations; when you expect a certain problem to arise under normal circumstances, you should … Continue reading
Java Tutorial 6: Useful Standard Methods, Access Modifiers and Abstract Classes
In the previous tutorial in this series, we looked at inheritance in Java. In this tutorial we continue with inheritance, plus we’ll look at some standard methods in Java and a few other interesting odds and ends. Access Modifiers Take … Continue reading
Java Tutorial 5: Inheritance and Polymorphism
Inheritance and polymorphism: two big words to strike fear into the heart of any new Java programmer. However, the concepts that they refer to are not that complex. Inheritance in Java Let’s take a look first at inheritance. Inheritance allows … Continue reading
Java Tutorial 4: Interfaces, and a Basic Swing App
The following code illustrates a basic Swing application. Swing is the standard GUI (Graphical User Interface) API for creating desktop applications with Java. Note, aside from a bunch of unfamiliar classes, we also use the notion of an interface to … Continue reading
Java Tutorial 3: Arrays, Methods, Loops and Conditionals
This seems like a good point to mention that you can find documentation for all the built-in classes in Java here: Java 7 API docs. Creating and Initializing Arrays in Java You can declare an array of any type or … Continue reading
Java Tutorial 2: Creating a Basic Class
In the first tutorial, we saw how you can create a basic java program, and we discussed the ‘primitive’ data types. In this tutorial, we’ll expand the original program a little to create an object from the basic class. In … Continue reading
Java Tutorial 1: Beginning Java
Downloads and Getting Started To start developing Java software, the first thing to do is to download the latest JDK (Java Development Kit). You can download the JDK here from Oracle.com. It’s free, and it includes everything you need to … Continue reading