Debugging in Eclipse: Java for Complete Beginners
A video on how to use the debugger in Eclipse. Debugging is something that a lot of developers happily get by without, but it’s something that’s sometimes very useful, and it’s certainly something that every aspiring developer should learn. Debuggers … Continue reading
Deciding Which Collection to Use: Java Collections Framework Video Tutorial, Part 12
How to decide which collection to use. Not only is this the first thing anyone needs to know when they’re planning to use a Java Collections class, but it’s also a favourite question of interviewers and examiners (although quite not … Continue reading
Java Multithreading: Swing and SwingWorker (Video Tutorial Part 15)
If you’re doing Swing (GUI) programming in Java, you might want to consider using the SwingWorker class for your multithreading needs. SwingWorker is a ferocious-looking but useful class that’s perfect for running stuff in the background while simultaneously updating progress … Continue reading
Implementing Iterable; Downloading HTML Using Java: Java Collections Framework Video Tutorial, Part 11
How and why to implement Iterable and Iterator in Java, with an example of downloading HTML in Java while iterating through a “for-each” loop. After starting the video, click the maximise button to make it fullscreen so you can see … Continue reading
Using Iterators: Java Collections Framework Video Tutorial, Part 10
A look at using iterators in Java; how “for each” loops work and how to add or remove elements from a list while iterating through it. After starting the video, click the maximise button to make it fullscreen so you … Continue reading
Queues: Java Collections Framework Video Tutorial, Part 9
A tutorial on the Java Queue interface, plus a couple of examples of Queues and a bit about the highly-useful (if you’re into multithreading) BlockingQueue interface. After starting the video, click the maximise button to make it fullscreen so you … Continue reading
Eclipse Shortcuts: Tips and Tricks for the Eclipse IDE for Java Developers
Learn some tips and tricks that can speed up your Java development in the Eclipse IDE, saving you time and making your code beautiful. When the video is running, click the maximize button in the lower-right-hand corner to make it … Continue reading
Natural Ordering and the Comparable Interface: Java Collections Framework Video Tutorial, Part 8
Learn how to give your classes a “natural order”. A tutorial on ordering your objects in TreeSets and TreeMaps and with Collections.sort() for Lists, using the Comparable Interface. In this tutorial I also take a look at the Collection interface … Continue reading
Sorting Lists Using Comparators: Java Collections Framework Video Tutorial, Part 7
A tutorial on sorting ArrayLists and other lists using the Comparator interface. In this tutorial you’ll learn how to sort your Java lists in an arbitrary order. After starting the video, click the maximise button to make it fullscreen so … Continue reading
Using Custom Objects in Sets and as Map Keys: Java Collections Framework Video Tutorial, Part 6
A tutorial on using your own objects as keys in Maps or in Sets. To use your own objects as keys in Maps or in Sets you need to tell Java how to compare your objects, by implementing the hashCode() … Continue reading
HashSet and Sets: Java Collections Framework Video Tutorial, Part 5
A tutorial on sets in Java; in this tutorial I show you how to use HashSet, TreeSet and LinkedHashSet, plus how to use the Set interface methods and how to do stuff like finding the intersection of two sets. After … Continue reading
Sorted Maps: Java Collections Framework Video Tutorial, Part 4
A tutorial on sorted maps in Java, plus some explanation of the Map interface and interfaces in general. After starting the video, click the maximise button to make it fullscreen so you can see the code! Code For This Tutorial … Continue reading
HashMap: Java Collections Framework Video Tutorial, Part 3
A tutorial on HashMap. Maps are data collections that function like lookup tables; basically you can store objects via “keys” (names, IDs, or even complex objects) and quickly retrieve them without having to look through an entire list. After starting … Continue reading
LinkedList: Java Collections Framework Video Tutorial, Part 2
The second part of the tutorial series on the Java Collections Framework; in this tutorial I explain when to use LinkedList rather than ArrayList; we look at how the two classes work internally and I also explain a bit about … Continue reading
Java Multithreading: Interrupting Threads (Video Tutorial Part 14)
What exactly are those pesky InterruptedExceptions? In this video I show you how to interrupt running threads in Java using the built-in thread interruption mechanism. After starting the video, click the maximise button to make it fullscreen so you can … Continue reading
Java Multithreading: Callable and Future (Video Tutorial Part 13)
How to use Callable and Future in Java to get results from your threads and to allow your threads to throw exceptions. Plus, Future allows you to control your threads, checking to see if they’re running or not, waiting for … Continue reading
ArrayList: Java Collections Framework Video Tutorial, Part 1
The first part of a series on the Java Collections Framework, an absolutely vital set of classes for organising data in your code. In this part we’ll look at ArrayList; an expandable array. ArrayList is probably the most used and … Continue reading
Java Multithreading: Semaphores (Video Tutorial Part 12)
A tutorial on semaphores in Java. Semaphores are mainly used to limit the number of simultaneous threads that can access a resources, but you can also use them to implement deadlock recovery systems since a semaphore with one permit is … Continue reading
Java Swing: Events (Video Tutorial Part 5)
A tutorial on how to implement custom events and how to deal with events generally in Java Swing applications. This tutorial shows you how to wire up your Swing app, so that the different parts of the application can communicate … Continue reading
Java Multithreading: Deadlock (Video Tutorial Part 11)
The causes of deadlock and two things you can do about it. This video also covers how to write a method that can safely acquire any number of locks in any order without causing deadlock, using the tryLock() method of … Continue reading
Java Multithreading: Re-entrant Locks (Video Tutorial Part 10)
How to use the ReentrantLock class in Java as an alternative to synchronized code blocks. ReentrantLocks let you do all the stuff that you can do with synchronized, wait and notify, plus some more stuff besides that may come in … Continue reading
Java Swing: GridBagLayout (Video Tutorial Part 4)
Conquer your fears of this, the most fearsome of the layout managers in Java, but also the most flexible and the most useful. Many Java programmers pretty much just use this one layout manager for everything. I explain step by … Continue reading
Java Swing: Panels (Video Tutorial Part 3)
How to add forms to your Swing application using JPanel. In this tutorial I show you how to begin to organise your Swing app and divide it into separate areas; in the next tutorial we’ll get onto actually using GridBagLayout … Continue reading
Java Swing: Adding Components (Video Tutorial Part 2)
A tutorial on adding components to your Swing applicatio. This tutorial covers buttons, text areas and BorderLayout. I also show you some useful web pages, including the free WindowBuilderPro from Google and the Swing Visual Guide pages. In the next … Continue reading
Java Multithreading: Low-Level Producer-Consumer (Video Tutorial Part 9)
In this tutorial we’ll look at how to implement the producer-consumer pattern using “low level” techniques; namely, wait, notify and synchronized. This isn’t the best way to implement a producer-consumer pattern in Java (see tutorial 7 for the best way); … Continue reading
Java Multithreading: Wait and Notify (Video Tutorial Part 8)
A tutorial on wait and notify in Java; low-level multithreading methods of the Object class that allow you to have one or more threads sleeping, only to be woken up by other threads at the right moment. Extremely useful for … Continue reading
Java Multithreading: Producer-Consumer (Video Tutorial Part 7)
A tutorial on how to implement the producer-consumer pattern in Java using the ArrayBlockingQueue Java class. Producer-Consumer is the situation where one or more threads are producing data items and adding them to a shared data store of some kind … Continue reading
Java Multithreading: Countdown Latches (Video Tutorial Part 6)
A video tutorial on using the excellent CountDownLatch Java class to synchronize your threads’ activities. After starting the video, click the maximise button to make it fullscreen so you can see the code! Code For This Tutorial import java.util.concurrent.CountDownLatch; import … Continue reading
Java Multithreading: Thread Pools (Video Tutorial Part 5)
A tutorial on how to manage multiple threads in Java using thread pools. With thread pools you can assign a whole gaggle of threads to work through your queue of tasks. After starting the video, click the maximise button to … Continue reading
Java Multithreading: Lock Objects (Video Tutorial Part 4)
This is the fourth part of our advanced Java multi-threading tutorial. In this tutorial I show you how you can use multiple locks to speed up complex multi-threaded code, sometimes dramatically. After starting the video, click the maximise button to … Continue reading
Java Swing: A Hello World GUI App (Video Tutorial Part 1)
Interested in GUI programming in Java? In this tutorial I show you how to build up a minimal “Hello World” user interface (Swing) app in Java. After starting the video, click the maximise button to make it fullscreen so you … Continue reading
Java Multithreading: Synchronized (Video Tutorial Part 3)
This is the third part of our advanced Java multi-threading tutorial. In this tutorial we look at using the synchronized keyword to coordinate actions between threads and prevent them screwing up each other’s work. After starting the video, click the … Continue reading
Java Multithreading: Volatile – Basic Thread Communication (Video Tutorial Part 2)
The second part of the advanced Java multi-threading tutorial. In this tutorial we look at using the volatile keyword to communicate between threads using flags. We also look at why the potential uses of volatile are somewhat limited. After starting … Continue reading
Java Multithreading: Starting Threads (Video Tutorial Part 1)
Does multithreading seem like a black art to you? This is the first part of an advanced Java tutorial on multithreading that hopefully will help you out. In this tutorial we look at the two ways of starting a thread … Continue reading
Beginner’s Java: Test Your Knowledge of Classes and Objects
Started programming in Java a few weeks/months ago, but getting horribly confused about classes, objects, settter and getters and this? This page is for you. If you’re pushed for time you can treat this page as a test and just … Continue reading