Topics A to Z
Java keywords, classes, methods and ideas from the lessons, A to Z, each in one line with the steps that teach it. It's a map of this course, not all of Java: for every class and method, see Java 21's API documentation.
247 topics
Operators and symbols
operator!Logical not: turns true into false and false into true, as in
!name.isEmpty().- And, or, not (module 6, Conditions and logic)
- Drills in Deathmatch (topic: Conditions and logic)
operator%The remainder operator:
17 % 5is 2, andn % 2 == 0checks that n is even.- The remainder operator % (module 6, Conditions and logic)
- Drills in Deathmatch (topic: Conditions and logic)
operator&&Logical and: true only when both sides are true; the right side isn't evaluated when the left side is false.
- And, or, not (module 6, Conditions and logic)
- Drills in Deathmatch (topic: Conditions and logic)
operator++Adds one to a variable, as in
count++;--takes one away.- Counting in a loop (module 8, Repeating with while)
- for loops (module 9, Loop conditions and for)
- Drills in Deathmatch (topic: Repeating with while)
operator+=Adds a value to a variable:
sum += pricemakes sum bigger by price (-=and*=work the same way).- Summing in a loop (module 8, Repeating with while)
- Multiplying in a loop (module 9, Loop conditions and for)
- Drills in Deathmatch (topic: Repeating with while)
separator->Separates a lambda's parameters from its body, as in
x -> x * 2, and a switch case from its result, as incase 1 -> "one";.- Lambda expressions and method references (module 37, Streams and lambdas)
- switch expressions and arrows (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: Streams and lambdas)
operator==Compares two values (
!=checks that they differ); for objects it checks whether both are the very same object, so compare strings with equals.- Comparison operators (module 5, Making decisions)
- Comparing text with equals (module 6, Conditions and logic)
- Reference variables (module 22, Primitive and reference variables)
- Drills in Deathmatch (topic: Making decisions)
operator||Logical or: true when at least one side is true; the right side isn't evaluated when the left side is true.
- And, or, not (module 6, Conditions and logic)
- Drills in Deathmatch (topic: Conditions and logic)
A
keywordabstractMarks a class that can't be made into objects, or a method without a body that every concrete subclass must have.
- Abstract classes and abstract methods (module 34, Inheritance and abstract classes)
- Collection, and choosing between an interface and an abstract class (module 35, Interfaces)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
abstract class
ideaA class that can't be made into objects, only extended; it can have abstract methods its subclasses must write.
- Abstract classes and abstract methods (module 34, Inheritance and abstract classes)
- Collection, and choosing between an interface and an abstract class (module 35, Interfaces)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
methodaddAdds a value to a list (at its end), a set or another collection.
- Creating a list (module 13, Lists)
- The list toolbox (module 14, For-each, list methods and lists in methods)
- Drills in Deathmatch (topic: Lists)
methodaddListenerRuns code every time a JavaFX value changes, such as the text of a field (
textProperty()) or a slider's value.- Reacting to typing (module 49, GUI: event handling)
- A slider that redraws a chart (module 51, Data visualization)
- Drills in Deathmatch (topic: GUI: event handling)
algorithm
ideaExact steps that solve a problem, such as finding the smallest value or sorting a list.
- Algorithms and the smallest value (module 28, Sorting and searching)
- Selection sort in code (module 28, Sorting and searching)
- Drills in Deathmatch (topic: Sorting and searching)
classAnimationTimerRuns its handle method once for every frame the screen draws, which makes a game loop.
- Steering with the keys (module 53, Project: an Asteroids-style game)
- Engines on: moving with vectors (module 53, Project: an Asteroids-style game)
- Drills in Deathmatch (topic: Project: an Asteroids-style game)
classApplicationThe class a JavaFX program extends;
launch(Main.class)in main starts it, and its start method gets the window (a Stage) to fill.- A first window (module 48, GUI: windows, components and layouts)
- Launch parameters (module 49, GUI: event handling)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
classArithmeticExceptionThrown when a whole number is divided by zero, with / or %; with doubles, dividing by zero gives Infinity or NaN instead.
- Reading a crash (module 12, Finding bugs)
- The call stack (module 11, Return values and the call stack)
- Drills in Deathmatch (topic: Finding bugs)
array
ideaA fixed number of places for values of one type, made with
new int[5]and used by index, from 0.- Creating an array (module 15, Arrays)
- Length and loops (module 15, Arrays)
- An array's size is fixed (module 45, Building your own list and hash map)
- Drills in Deathmatch (topic: Arrays)
classArrayDequeA double-ended queue kept in an array, which works as a stack (push, pop, peek) and as a queue (offer, poll).
- ArrayDeque from the library (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
classArrayListA list that grows as values are added, keeping them in order at indexes from 0.
- Creating a list (module 13, Lists)
- What a list holds (module 13, Lists)
- The list toolbox (module 14, For-each, list methods and lists in methods)
- Drills in Deathmatch (topic: Lists)
classArraysReady-made methods for arrays, such as
Arrays.toStringandArrays.sort.- The short way to create an array (module 15, Arrays)
- Java's own sorting methods (module 28, Sorting and searching)
- Drills in Deathmatch (topic: Sorting and searching)
methodArrays.toStringGives an array's values as text, such as
[3, 1, 2], for printing.- The short way to create an array (module 15, Arrays)
- Swapping, and sorting by hand (module 28, Sorting and searching)
- Drills in Deathmatch (topic: Arrays)
methodassertEqualsMakes a JUnit test fail unless the expected value equals the actual one,
assertEquals(expected, actual).- Unit tests with JUnit (module 26, Troubleshooting and unit testing)
- More assertions and good tests (module 26, Troubleshooting and unit testing)
- Drills in Deathmatch (topic: Troubleshooting and unit testing)
methodaverageEnds an IntStream with the average of its values, an OptionalDouble, since an empty stream has none.
- Ending a stream: count, sum, average, collect (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
B
classBarChartA JavaFX chart of bars for the categories of a CategoryAxis.
- Bar charts for categories (module 51, Data visualization)
- Honest charts (module 51, Data visualization)
- Drills in Deathmatch (topic: Data visualization)
base case
ideaThe case a recursive method answers without calling itself, which stops the recursion.
- Base case and return value (module 55, Recursion)
- When recursion goes wrong (module 55, Recursion)
- Drills in Deathmatch (topic: Recursion)
binary search
ideaFinds a value in a sorted list by looking at the middle and throwing away the half it can't be in, again and again.
- Binary search (module 28, Sorting and searching)
- Recursive binary search (module 55, Recursion)
- Drills in Deathmatch (topic: Sorting and searching)
binary search tree
ideaA tree of nodes in which every smaller value is on a node's left and every bigger one on its right, so a search goes down one path.
- Binary search trees (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
keywordbooleanThe primitive type of the two truth values,
trueandfalse.- Reading doubles and booleans (module 3, Variables and types)
- Booleans in conditions (module 6, Conditions and logic)
- Drills in Deathmatch (topic: Conditions and logic)
classBorderPaneA JavaFX layout with five regions, top, bottom, left, right and center.
- BorderPane: five regions (module 48, GUI: windows, components and layouts)
- One frame, changing content (module 50, GUI: multiple views)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
keywordbreakLeaves the innermost loop or switch at once; the program goes on after it.
- while (true) and break (module 8, Repeating with while)
- The switch statement (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: Repeating with while)
C
call stack
ideaThe methods running right now, each waiting for the one it called; a crash report lists them.
- The call stack (module 11, Return values and the call stack)
- Reading a crash (module 12, Finding bugs)
- Drills in Deathmatch (topic: Return values and the call stack)
classCanvasA JavaFX surface to draw on, through its GraphicsContext and methods such as setFill, fillRect and fillOval.
- Drawing on a canvas (module 52, Drawing, images and sound)
- Drawing with the mouse (module 52, Drawing, images and sound)
- Drills in Deathmatch (topic: Drawing, images and sound)
keywordcaseOne label of a switch, with the code that runs when the value matches it.
- The switch statement (module 57, switch, var and text blocks)
- switch expressions and arrows (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
cast
ideaTurns a value into another type, such as
(double) sumfor a decimal division, or an object into a more specific type.- Division and casting (module 4, Calculating with numbers)
- instanceof and casts (module 36, Polymorphism)
- Drills in Deathmatch (topic: Calculating with numbers)
keywordcatchFollows a try block and handles the exceptions of the class it names (and its subclasses), so the program can go on.
- Catching an exception: try and catch (module 42, Exceptions)
- Choosing what to catch (module 42, Exceptions)
- When the file is missing (module 20, Reading files)
- Drills in Deathmatch (topic: Exceptions)
keywordcharThe primitive type of a single character, written in single quotes, such as
'a'.- Characters (module 16, Working with strings)
- Primitive variables (module 22, Primitive and reference variables)
- Drills in Deathmatch (topic: Working with strings)
methodcharAtGives the character (a char) at an index of a string, counting from 0.
- Characters (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
checked exception
ideaAn exception, such as IOException, that a method must either catch or list after throws, or the code doesn't compile.
- Checked exceptions and throws (module 42, Exceptions)
- Exceptions and interfaces (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
keywordclassDeclares a class, the blueprint of objects, with their instance variables, constructors and methods.
- Writing a class (module 17, Classes and objects)
- Constructors (module 17, Classes and objects)
- Methods of an object (module 17, Classes and objects)
- Drills in Deathmatch (topic: Classes and objects)
class diagram
ideaA drawing of a program's classes as boxes, with their variables and methods, and arrows for how they're connected.
- A class as a box (module 40, Class diagrams)
- Arrows between classes (module 40, Class diagrams)
- Inheritance and abstract classes (module 40, Class diagrams)
- Drills in Deathmatch (topic: Class diagrams)
methodcollectEnds a stream by gathering its values, such as into a new list with
Collectors.toList().- Ending a stream: count, sum, average, collect (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
classCollectionsReady-made methods for lists and other collections, such as
Collections.sortandCollections.shuffle.- Java's own sorting methods (module 28, Sorting and searching)
- Picking, shuffling and drawing (module 46, Random numbers)
- Drills in Deathmatch (topic: Sorting and searching)
methodCollections.sortSorts a list in place into its natural order (smallest first), or into the order a Comparator gives.
- Java's own sorting methods (module 28, Sorting and searching)
- Comparable: a natural order for your class (module 38, Ordering objects: Comparable and Comparator)
- Drills in Deathmatch (topic: Sorting and searching)
comment
ideaText in the code for people, which the compiler skips, after
//to the end of the line or between/*and*/.- Comments (module 1, Printing)
- Names and comments (module 12, Finding bugs)
- Drills in Deathmatch (topic: Printing)
compact constructor
ideaA record constructor without a parameter list, which checks or adjusts the values before the record keeps them.
- Checking values with a compact constructor (module 56, Records)
- Drills in Deathmatch (topic: Records)
classComparableThe interface of classes with a natural order; its compareTo method says which of two objects comes first.
- Comparable: a natural order for your class (module 38, Ordering objects: Comparable and Comparator)
- Natural order or comparator? (module 38, Ordering objects: Comparable and Comparator)
- Drills in Deathmatch (topic: Ordering objects: Comparable and Comparator)
classComparatorAn object that compares two values, given to a sort to choose the order, such as
Comparator.comparing(Book::getYear).- Comparator: an order given to the sort (module 38, Ordering objects: Comparable and Comparator)
- Several criteria, and sorted streams (module 38, Ordering objects: Comparable and Comparator)
- Natural order or comparator? (module 38, Ordering objects: Comparable and Comparator)
- Drills in Deathmatch (topic: Ordering objects: Comparable and Comparator)
methodComparator.comparingMakes a Comparator that orders objects by one of their values, as in
Comparator.comparing(Person::getAge).- Comparator: an order given to the sort (module 38, Ordering objects: Comparable and Comparator)
- Several criteria, and sorted streams (module 38, Ordering objects: Comparable and Comparator)
- Drills in Deathmatch (topic: Ordering objects: Comparable and Comparator)
methodcompareToComparable's method, which returns a negative number when this object comes first, zero for the same place, and a positive number when it comes after.
- Comparable: a natural order for your class (module 38, Ordering objects: Comparable and Comparator)
- Drills in Deathmatch (topic: Ordering objects: Comparable and Comparator)
comparison operators
idea<,<=,>,>=,==and!=, which compare two values and give true or false.- Comparison operators (module 5, Making decisions)
- Drills in Deathmatch (topic: Making decisions)
compiler
ideaThe program (javac) that checks Java code and turns it into class files the Java virtual machine runs.
- Your first Java program (module 1, Printing)
- Reading compiler errors (module 1, Printing)
- Drills in Deathmatch (topic: Printing)
compiler error
ideaA message from javac saying why the code can't be compiled, with the file, the line and what it expected.
- Reading compiler errors (module 1, Printing)
- Drills in Deathmatch (topic: Printing)
concatenation
ideaJoining texts with
+, as in"Hi " + name; a number joined to a text becomes text.- Joining strings with + (module 2, Reading input and strings)
- Drills in Deathmatch (topic: Reading input and strings)
classConnectionA connection to a database through JDBC, made with
DriverManager.getConnectionand closed when done.- A real database with JDBC (module 54, Libraries, Maven and databases)
- Drills in Deathmatch (topic: Libraries, Maven and databases)
constructor
ideaThe code that sets up a new object, with the class's name and no return type;
newruns it.- Constructors (module 17, Classes and objects)
- Several constructors (module 21, Designing classes and overloading)
- One constructor calling another (module 21, Designing classes and overloading)
- Drills in Deathmatch (topic: Classes and objects)
methodcontainsTrue when a list or set holds the value, or a string has the text in it.
- contains and indexOf (module 14, For-each, list methods and lists in methods)
- Finding parts of a string (module 16, Working with strings)
- Drills in Deathmatch (topic: For-each, list methods and lists in methods)
methodcontainsKeyTrue when a map has the key.
- One value per key (module 31, Hash maps)
- Drills in Deathmatch (topic: Hash maps)
keywordcontinueSkips the rest of the loop's body and goes on with the next round.
- continue (module 8, Repeating with while)
- Drills in Deathmatch (topic: Repeating with while)
methodcountEnds a stream and gives the number of values that reached it, as a long.
- Why streams: filter and count (module 37, Streams and lambdas)
- Ending a stream: count, sum, average, collect (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
CSV
ideaA text format with one record per line and the values separated by commas (or another character), read with split.
- Records in a file (module 20, Reading files)
- Drills in Deathmatch (topic: Reading files)
D
data access object
ideaA class (a DAO) whose methods save, find and delete objects in storage, so the rest of the program doesn't see how.
- Data access objects (module 54, Libraries, Maven and databases)
- A text UI over a DAO (module 54, Libraries, Maven and databases)
- Drills in Deathmatch (topic: Libraries, Maven and databases)
debugging
ideaFinding why a program does the wrong thing, for example by reading the crash report or printing values as it runs.
- Print debugging (module 12, Finding bugs)
- Testing with different inputs (module 12, Finding bugs)
- Bugs and troubleshooting step by step (module 26, Troubleshooting and unit testing)
- Drills in Deathmatch (topic: Finding bugs)
keyworddefaultThe branch of a switch that runs when no case matches.
- The switch statement (module 57, switch, var and text blocks)
- switch expressions and arrows (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
keyworddoubleThe primitive type of decimal numbers (64-bit floating point), such as
3.75;Double.valueOfreads one from text.- Variables and their types (module 3, Variables and types)
- Reading doubles and booleans (module 3, Variables and types)
- Division and casting (module 4, Calculating with numbers)
- Drills in Deathmatch (topic: Variables and types)
E
effectively final
ideaA local variable or parameter that is never changed after it's set; a lambda can use its method's local variables and parameters only if they are effectively final.
- Handlers that remember (module 49, GUI: event handling)
- Lambda expressions and method references (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: GUI: event handling)
keywordelseThe branch of an if statement that runs when its condition is false;
else ifchecks another condition first.- else (module 5, Making decisions)
- else if chains (module 5, Making decisions)
- The first true branch wins (module 5, Making decisions)
- Drills in Deathmatch (topic: Making decisions)
encapsulation
ideaKeeping an object's data private, so that other code changes it only through the class's own methods.
- Writing a class (module 17, Classes and objects)
- Drills in Deathmatch (topic: Classes and objects)
keywordenumDeclares an enum, a type with a fixed set of named values, such as the suits of playing cards.
- Enums: a fixed set of values (module 39, StringBuilder, regular expressions, enums and iterators)
- Enums with fields, a constructor and methods (module 39, StringBuilder, regular expressions, enums and iterators)
- switch on strings and enums (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: StringBuilder, regular expressions, enums and iterators)
methodequalsCompares the contents of two objects, such as two strings; a class writes its own equals to say when two of its objects are equal.
- Comparing text with equals (module 6, Conditions and logic)
- Equal objects (module 23, Objects working together)
- equals, again (module 32, Comparing objects: equals and hashCode)
- Drills in Deathmatch (topic: Objects working together)
event handler
ideaCode, usually a lambda, that a GUI runs when something happens, such as a click or a key press.
- Buttons that do something (module 49, GUI: event handling)
- Handlers that remember (module 49, GUI: event handling)
- Drills in Deathmatch (topic: GUI: event handling)
classExceptionThe class of the problems a program is meant to catch; each kind of problem is a subclass of it.
- Catching an exception: try and catch (module 42, Exceptions)
- Choosing what to catch (module 42, Exceptions)
- When the file is missing (module 20, Reading files)
- Drills in Deathmatch (topic: Exceptions)
keywordextendsMakes a class a subclass of another class, so it inherits that class's methods and variables.
- extends: a class built on another (module 34, Inheritance and abstract classes)
- Constructors and super(...) (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
F
classFilesReady-made methods for files, such as
Files.linesandFiles.readAllLines(in java.nio.file).- Reading a file as a stream (module 37, Streams and lambdas)
- Checked exceptions and throws (module 42, Exceptions)
- Drills in Deathmatch (topic: Streams and lambdas)
methodFiles.linesReads a file as a stream of its lines; it throws an IOException that must be handled.
- Reading a file as a stream (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
classFileWriterWrites text into a file;
new FileWriter(name, true)adds to the end of the file instead of emptying it first.- Adding to a file (module 43, Writing files)
- Drills in Deathmatch (topic: Writing files)
methodfilterA stream step that keeps only the values for which a condition (a lambda) is true.
- Why streams: filter and count (module 37, Streams and lambdas)
- Lambda expressions and method references (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
keywordfinalMarks a variable that can be given a value only once; a final class can't be extended, and a final method can't be overridden.
- Handlers that remember (module 49, GUI: event handling)
- Around the edges of the sea (module 53, Project: an Asteroids-style game)
keywordfinallyA block after try and catch that runs whether the try block ends normally or with an exception.
- Choosing what to catch (module 42, Exceptions)
- Exceptions and resources (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
keywordforA loop with its start, condition and update in one line:
for (int i = 0; i < 10; i++).- for loops (module 9, Loop conditions and for)
- Bounds from input (module 9, Loop conditions and for)
- The for loop again (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: Loop conditions and for)
for-each loop
ideaA loop that goes through every value of a list, set or array:
for (String name : names).- The for-each loop (module 14, For-each, list methods and lists in methods)
- Length and loops (module 15, Arrays)
- Drills in Deathmatch (topic: For-each, list methods and lists in methods)
methodforEachRuns a lambda for every value of a list or a stream, as in
names.forEach(name -> System.out.println(name)).- Lambda expressions and method references (module 37, Streams and lambdas)
- Steps in the middle: map, sorted, distinct, limit, skip (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
G
generics
ideaClasses and methods with type parameters, such as
ArrayList<String>, so one class works for many types and the compiler checks them.- Why type parameters (module 44, Type parameters (generics))
- One class, many types (module 44, Type parameters (generics))
- Several type parameters, and a list of T (module 44, Type parameters (generics))
- Drills in Deathmatch (topic: Type parameters (generics))
methodgetGives the value at an index of a list, as in
list.get(0)for the first, or the value of a key in a map.- Getting values by index (module 13, Lists)
- Keys and values (module 31, Hash maps)
- Drills in Deathmatch (topic: Lists)
methodgetOrDefaultGives a map's value for a key, or the given default when the key isn't in the map.
- Keys and values (module 31, Hash maps)
- A hash map inside a class (module 31, Hash maps)
- Drills in Deathmatch (topic: Hash maps)
getter
ideaA method that returns the value of an instance variable, such as
getName(); a setter gives one a new value.- Getters (module 18, Getters, toString and bigger classes)
- Drills in Deathmatch (topic: Getters, toString and bigger classes)
methodgetTextGives the text in a JavaFX text field, text area or label (setText changes it).
- Text fields and text areas (module 48, GUI: windows, components and layouts)
- Buttons that do something (module 49, GUI: event handling)
- Drills in Deathmatch (topic: GUI: event handling)
classGridPaneA JavaFX layout that places its components in the cells of a grid, by column and row.
- HBox, VBox, spacing and GridPane (module 48, GUI: windows, components and layouts)
- A board of buttons, and the end of part 13 (module 50, GUI: multiple views)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
H
hash code
ideaA number worked out from an object's values, which picks the bucket a hash map keeps it in.
- What a hash code is (module 32, Comparing objects: equals and hashCode)
- A hash map of your own (module 45, Building your own list and hash map)
- Drills in Deathmatch (topic: Comparing objects: equals and hashCode)
hash map
ideaA map that keeps its pairs in buckets chosen by the key's hash code, so finding a key stays fast even with many pairs.
- Keys and values (module 31, Hash maps)
- A hash map of your own (module 45, Building your own list and hash map)
- Collisions, updates, removing and growing (module 45, Building your own list and hash map)
- Drills in Deathmatch (topic: Hash maps)
methodhashCodeGives a number for an object, which HashMap and HashSet use; equal objects must have equal hash codes, and
Objects.hash(name, age)makes one.- What a hash code is (module 32, Comparing objects: equals and hashCode)
- Writing hashCode (module 32, Comparing objects: equals and hashCode)
- Drills in Deathmatch (topic: Comparing objects: equals and hashCode)
classHashMapA map that keeps pairs of a key and a value and finds the value of a key quickly, using the key's hashCode.
- Keys and values (module 31, Hash maps)
- One value per key (module 31, Hash maps)
- Going through a hash map (module 31, Hash maps)
- Drills in Deathmatch (topic: Hash maps)
classHashSetA set kept in a hash table, with no duplicates, a quick contains, and no promised order.
- Java's Set interface and HashSet (module 35, Interfaces)
- Drills in Deathmatch (topic: Interfaces)
methodhasNextLineTrue while a Scanner has another line to read, for reading until the input or the file ends.
- Reading until the input ends (module 20, Reading files)
- Reading a file line by line (module 20, Reading files)
- Drills in Deathmatch (topic: Reading files)
I
keywordifRuns a block of code only when its condition is true.
- if (module 5, Making decisions)
- Comparison operators (module 5, Making decisions)
- Drills in Deathmatch (topic: Making decisions)
classIllegalArgumentExceptionThe exception to throw when a method is given a value it can't accept.
- Throwing an exception (module 42, Exceptions)
- The details of an exception (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
classImageA picture loaded into a JavaFX program, shown in a window with an ImageView.
- Images as grids of pixels (module 52, Drawing, images and sound)
- Making an image smaller (module 52, Drawing, images and sound)
- Drills in Deathmatch (topic: Drawing, images and sound)
immutability
ideaObjects that can't be changed after they're made, such as strings and Point2D; a change gives a new object.
- Strings again (module 16, Working with strings)
- Engines on: moving with vectors (module 53, Project: an Asteroids-style game)
- Drills in Deathmatch (topic: Working with strings)
keywordimplementsSays that a class implements an interface; unless the class is abstract, it must then have all of the interface's abstract methods.
- An interface: a promise of methods (module 35, Interfaces)
- Many classes, many interfaces (module 35, Interfaces)
- Drills in Deathmatch (topic: Interfaces)
keywordimportLets a file use a class of another package by its short name, as in
import java.util.Scanner;.- Reading a line with Scanner (module 2, Reading input and strings)
- import: short names for classes of other packages (module 41, Packages and imports)
- Drills in Deathmatch (topic: Packages and imports)
index
ideaA value's place in a list, array or string, counting from 0.
- Getting values by index (module 13, Lists)
- When the index doesn't exist (module 13, Lists)
- Characters (module 16, Working with strings)
- Drills in Deathmatch (topic: Lists)
methodindexOfGives the index where a value is first found in a list, or a text in a string, or -1 when it isn't there.
- contains and indexOf (module 14, For-each, list methods and lists in methods)
- Finding parts of a string (module 16, Working with strings)
- Drills in Deathmatch (topic: For-each, list methods and lists in methods)
classIndexOutOfBoundsExceptionThrown when a list is given an index below 0 or not below its size; arrays and strings throw subclasses with their own names.
- When the index doesn't exist (module 13, Lists)
- Length and loops (module 15, Arrays)
- Characters (module 16, Working with strings)
- Drills in Deathmatch (topic: Lists)
inheritance
ideaA subclass gets the methods and variables of its superclass and adds or changes some of its own.
- Every class inherits from Object (module 34, Inheritance and abstract classes)
- extends: a class built on another (module 34, Inheritance and abstract classes)
- When to inherit: is a, or has a? (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
instance variable
ideaA variable of an object, declared in its class outside the methods; each object has its own copy.
- Writing a class (module 17, Classes and objects)
- Constructors (module 17, Classes and objects)
- Drills in Deathmatch (topic: Classes and objects)
keywordinstanceofChecks whether an object is of a given type; with a name after the type, as in
o instanceof Dog d, it also gives the object that type.- instanceof and casts (module 36, Polymorphism)
- instanceof with a pattern (module 58, Pattern matching and sealed types)
- Equal objects (module 23, Objects working together)
- Drills in Deathmatch (topic: Polymorphism)
keywordintThe primitive type of whole numbers from -2147483648 to 2147483647 (32 bits).
- Variables and their types (module 3, Variables and types)
- Reading integers (module 3, Variables and types)
- Drills in Deathmatch (topic: Variables and types)
classIntegerThe class of int values as objects; lists hold Integer, and
Integer.valueOfreads a whole number from text.- Reading integers (module 3, Variables and types)
- What a list holds (module 13, Lists)
- Drills in Deathmatch (topic: Variables and types)
integer division
ideaDividing one int by another gives a whole number and drops the rest, so
7 / 2is 3.- Division and casting (module 4, Calculating with numbers)
- Drills in Deathmatch (topic: Calculating with numbers)
methodInteger.valueOfTurns a text of digits into a whole number, as in
int age = Integer.valueOf(scanner.nextLine());.- Reading integers (module 3, Variables and types)
- Calculating with input (module 4, Calculating with numbers)
- Drills in Deathmatch (topic: Variables and types)
keywordinterfaceDeclares an interface, a type that lists methods; every class that implements it promises to have them.
- An interface: a promise of methods (module 35, Interfaces)
- An interface as a variable's type (module 35, Interfaces)
- An interface as a parameter's type (module 35, Interfaces)
- Drills in Deathmatch (topic: Interfaces)
classIntStreamA stream of int values, with sum, average and max;
IntStream.range(0, 5)gives 0 to 4.- reduce, and IntStream (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
classIOExceptionThe checked exception of reading and writing problems, such as a file that can't be read.
- Checked exceptions and throws (module 42, Exceptions)
- Adding to a file (module 43, Writing files)
- Drills in Deathmatch (topic: Exceptions)
is a and has a
ideaA subclass should be a kind of its superclass (is a); when one object only uses another, keep it in a variable instead (has a).
- When to inherit: is a, or has a? (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
methodisEmptyTrue for a string with no characters, or a list, set or map with no values.
- Processing many lines (module 16, Working with strings)
- The list toolbox (module 14, For-each, list methods and lists in methods)
- Drills in Deathmatch (topic: For-each, list methods and lists in methods)
classIteratorGoes through a collection one value at a time with hasNext and next, and can remove the value it just gave.
- Iterators: removing while going through (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: StringBuilder, regular expressions, enums and iterators)
J
JavaFX
toolJava's library for programs with windows, buttons, charts and drawings; Java Arena runs a practice version of it in the browser.
- A first window (module 48, GUI: windows, components and layouts)
- Scene, layout and components (module 48, GUI: windows, components and layouts)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
JDBC
toolJava's way of talking to a database, through Connection, PreparedStatement and ResultSet.
- A real database with JDBC (module 54, Libraries, Maven and databases)
- Drills in Deathmatch (topic: Libraries, Maven and databases)
JUnit
toolA library for unit tests in Java; a test is a method marked
@Testthat checks results with assertEquals and the like.- Unit tests with JUnit (module 26, Troubleshooting and unit testing)
- More assertions and good tests (module 26, Troubleshooting and unit testing)
- Drills in Deathmatch (topic: Troubleshooting and unit testing)
K
methodkeySetGives a map's keys, to go through with a for-each loop.
- Going through a hash map (module 31, Hash maps)
- Counting and grouping (module 33, Grouping data with hash maps)
- Drills in Deathmatch (topic: Hash maps)
L
classLabelA JavaFX component that shows a text the user can't edit.
- A first window (module 48, GUI: windows, components and layouts)
- Scene, layout and components (module 48, GUI: windows, components and layouts)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
lambda
ideaA small function written in place: parameters, an arrow and an expression, as in
x -> x * 2.- Lambda expressions and method references (module 37, Streams and lambdas)
- Why streams: filter and count (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
layout
ideaA JavaFX container, such as VBox, HBox, GridPane or BorderPane, that places the components inside it.
- Scene, layout and components (module 48, GUI: windows, components and layouts)
- HBox, VBox, spacing and GridPane (module 48, GUI: windows, components and layouts)
- Layouts inside layouts (module 48, GUI: windows, components and layouts)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
methodlengthtext.length()is the number of characters in a string, andnumbers.length(no parentheses) the number of places in an array.- Characters (module 16, Working with strings)
- Length and loops (module 15, Arrays)
- Drills in Deathmatch (topic: Working with strings)
linear search
ideaLooks at the values one by one, from the first, until it finds the one it's looking for.
- Linear search (module 28, Sorting and searching)
- Drills in Deathmatch (topic: Sorting and searching)
classLineChartA JavaFX chart that joins each series' points with lines, usually on two NumberAxis axes.
- A first line chart (module 51, Data visualization)
- Several series from a map (module 51, Data visualization)
- Drills in Deathmatch (topic: Data visualization)
linked list
ideaA list made of nodes, each holding a value and a reference to the next node.
- Nodes and links (module 59, Linked lists, stacks, queues and trees)
- A linked list class (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
classListThe interface of lists, which ArrayList implements; a variable of type List can hold any kind of list.
- Java's List interface (module 35, Interfaces)
- Drills in Deathmatch (topic: Interfaces)
list
ideaValues in order, with an index each, which can grow and shrink, such as an ArrayList.
- Creating a list (module 13, Lists)
- Getting values by index (module 13, Lists)
- Looping over a list (module 13, Lists)
- Drills in Deathmatch (topic: Lists)
local variable
ideaA variable declared inside a method (or a block), which exists only while that method runs.
- Variables inside methods (module 11, Return values and the call stack)
- Drills in Deathmatch (topic: Return values and the call stack)
keywordlongThe primitive type of whole numbers too big for an int (64 bits); a long literal ends with L, as in
5000000000L.- Primitive variables (module 22, Primitive and reference variables)
- Why streams: filter and count (module 37, Streams and lambdas)
loop
ideaCode that runs again and again, while a condition holds or once for each value.
- while (true) and break (module 8, Repeating with while)
- while with a condition (module 9, Loop conditions and for)
- for loops (module 9, Loop conditions and for)
- Drills in Deathmatch (topic: Repeating with while)
M
main method
ideapublic static void main(String[] args), where a Java program starts running.- Your first Java program (module 1, Printing)
- Defining and calling a method (module 10, Methods and parameters)
- Drills in Deathmatch (topic: Printing)
classMapThe interface of maps, which HashMap and TreeMap implement.
- Java's Map interface (module 35, Interfaces)
- Drills in Deathmatch (topic: Interfaces)
methodmapA stream step that turns every value into another, as in
.map(name -> name.length()).- Steps in the middle: map, sorted, distinct, limit, skip (module 37, Streams and lambdas)
- Streams of objects (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
methodmapToIntTurns a stream into an IntStream of int values, which has sum, average and max.
- Ending a stream: count, sum, average, collect (module 37, Streams and lambdas)
- Streams of input (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
methodmatchesTrue when the whole string fits a regular expression, as in
code.matches("[0-9]{5}").- Regular expressions: matches, | and groups (module 39, StringBuilder, regular expressions, enums and iterators)
- Quantifiers and character classes (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: StringBuilder, regular expressions, enums and iterators)
classMathA class of ready-made math methods and constants, such as
Math.sqrt,Math.abs,Math.maxandMath.PI.- Math methods (module 7, Problem-solving patterns)
- Drills in Deathmatch (topic: Problem-solving patterns)
methodMath.absThe absolute value of a number, its distance from zero, so
Math.abs(-4)is 4.- Math methods (module 7, Problem-solving patterns)
- Drills in Deathmatch (topic: Problem-solving patterns)
methodMath.maxThe bigger of two numbers (
Math.mingives the smaller).- Math methods (module 7, Problem-solving patterns)
- Drills in Deathmatch (topic: Problem-solving patterns)
methodMath.randomA random double from 0.0 up to, but not including, 1.0.
- Decimal numbers and chances (module 46, Random numbers)
- Drills in Deathmatch (topic: Random numbers)
methodMath.sqrtThe square root of a number, as a double.
- Math methods (module 7, Problem-solving patterns)
- Drills in Deathmatch (topic: Problem-solving patterns)
Maven
toolA build tool that downloads the libraries in a project's pom.xml, compiles the code, runs the tests (
mvn test) and packages it.- Build tools: Maven and a project's layout (module 54, Libraries, Maven and databases)
- Packaging, other tools, and the end of the course (module 54, Libraries, Maven and databases)
- Drills in Deathmatch (topic: Libraries, Maven and databases)
merge sort
ideaSorts by splitting the list in two halves, sorting each half (recursively) and merging the two sorted halves.
- Divide and conquer: merge sort (module 55, Recursion)
- Drills in Deathmatch (topic: Recursion)
method
ideaA named piece of code that a program calls, with parameters for what it gets and a return type for what it gives back.
- Defining and calling a method (module 10, Methods and parameters)
- Parameters (module 10, Methods and parameters)
- Returning a value (module 11, Return values and the call stack)
- Drills in Deathmatch (topic: Methods and parameters)
method reference
ideaA short form of a lambda that only calls one method:
String::length,System.out::println.- Lambda expressions and method references (module 37, Streams and lambdas)
- Streams of objects (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
N
nested loops
ideaA loop inside another; for each round of the outer loop, the inner loop runs all its rounds.
- Going through a grid (module 47, Two-dimensional arrays)
- Drills in Deathmatch (topic: Two-dimensional arrays)
keywordnewMakes a new object (running its constructor) or a new array.
- Constructors (module 17, Classes and objects)
- Creating an array (module 15, Arrays)
- Creating a list (module 13, Lists)
- Drills in Deathmatch (topic: Classes and objects)
methodnextIntRandom's
nextInt(6)gives a random whole number from 0 to 5, each as likely.- Random and nextInt (module 46, Random numbers)
- Seeds: the same numbers every time (module 46, Random numbers)
- Drills in Deathmatch (topic: Random numbers)
methodnextLineReads the next line the Scanner has, as a String without its line break.
- Reading a line with Scanner (module 2, Reading input and strings)
- Several inputs in order (module 2, Reading input and strings)
- Drills in Deathmatch (topic: Reading input and strings)
literalnullThe value of a reference variable that refers to no object; calling a method on it throws a NullPointerException.
- null and NullPointerException (module 22, Primitive and reference variables)
- Drills in Deathmatch (topic: Primitive and reference variables)
classNullPointerExceptionThrown when code uses null as if it were an object, such as calling a method through a variable that holds null.
- null and NullPointerException (module 22, Primitive and reference variables)
- Drills in Deathmatch (topic: Primitive and reference variables)
classNumberFormatExceptionThrown when text that isn't a number is turned into one, as in
Integer.valueOf("ten").- Reading integers (module 3, Variables and types)
- Catching an exception: try and catch (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
O
classObjectThe class every class inherits from, directly or through its superclasses; it has equals, hashCode and toString.
- Every class inherits from Object (module 34, Inheritance and abstract classes)
- Equal objects (module 23, Objects working together)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
object
ideaA value made from a class with
new, with its own instance variables and the class's methods.- Objects you already know (module 17, Classes and objects)
- Writing a class (module 17, Classes and objects)
- Several objects (module 17, Classes and objects)
- Drills in Deathmatch (topic: Classes and objects)
object-oriented programming
ideaBuilding a program out of objects that keep their data and the methods that work on it together.
- The same program with objects (module 27, Procedural and object-oriented programs)
- The command program with a class (module 27, Procedural and object-oriented programs)
- Drills in Deathmatch (topic: Procedural and object-oriented programs)
methodofferPuts a value at the end of a queue (poll takes the first one off).
- ArrayDeque from the library (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
overloading
ideaSeveral methods or constructors with the same name but different parameter types or counts; the call's arguments pick one.
- Methods with the same name (module 21, Designing classes and overloading)
- Several constructors (module 21, Designing classes and overloading)
- Drills in Deathmatch (topic: Designing classes and overloading)
annotation@OverrideAn annotation that asks the compiler to check that the method really overrides a method of a superclass or interface.
- Overriding methods: @Override and super (module 34, Inheritance and abstract classes)
- The object's class decides which method runs (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
overriding
ideaA subclass writing its own version of an inherited method, with the same name and parameters; mark it with @Override.
- Overriding methods: @Override and super (module 34, Inheritance and abstract classes)
- The object's class decides which method runs (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
P
keywordpackageThe line at the top of a file that says which package (folder of classes) its classes belong to.
- Packages: classes in folders (module 41, Packages and imports)
- import: short names for classes of other packages (module 41, Packages and imports)
- Access across packages (module 41, Packages and imports)
- Drills in Deathmatch (topic: Packages and imports)
parameter
ideaA variable in a method's header that gets the value (the argument) the caller gives; it's a copy of that value.
- Parameters (module 10, Methods and parameters)
- Several parameters (module 10, Methods and parameters)
- Parameters are copies (module 10, Methods and parameters)
- Drills in Deathmatch (topic: Methods and parameters)
classPathsPaths.get("data.txt")makes the Path of a file, for a Scanner or Files to read.- Files and folders (module 20, Reading files)
- Reading a file line by line (module 20, Reading files)
- Drills in Deathmatch (topic: Reading files)
pattern matching
ideaChecking a value's type and naming it in one go, as in
if (shape instanceof Circle c)or acase Circle c ->of a switch.- instanceof with a pattern (module 58, Pattern matching and sealed types)
- switch on sealed types (module 58, Pattern matching and sealed types)
- Drills in Deathmatch (topic: Pattern matching and sealed types)
classPoint2DAn unchangeable pair of an x and a y, used for positions and movements; add gives a new point.
- Engines on: moving with vectors (module 53, Project: an Asteroids-style game)
- Drills in Deathmatch (topic: Project: an Asteroids-style game)
polymorphism
ideaOne variable or parameter type that holds objects of many classes, each running its own version of a method.
- Hierarchies: one object, many types (module 36, Polymorphism)
- A program built on polymorphism (module 36, Polymorphism)
- Drills in Deathmatch (topic: Polymorphism)
precedence
ideaThe order in which operators are worked out, such as
*and/before+and-; parentheses change it.- Arithmetic and precedence (module 4, Calculating with numbers)
- Drills in Deathmatch (topic: Calculating with numbers)
classPreparedStatementAn SQL statement with ? marks for its values, filled in with setString and setInt, which keeps the values apart from the SQL.
- A real database with JDBC (module 54, Libraries, Maven and databases)
- Drills in Deathmatch (topic: Libraries, Maven and databases)
primitive type
ideaOne of Java's eight basic types (int, double, boolean, char, long, float, byte and short), whose variables hold the value itself.
- Primitive variables (module 22, Primitive and reference variables)
- What a list holds (module 13, Lists)
- Drills in Deathmatch (topic: Primitive and reference variables)
classPrintWriterWrites text with print and println;
new PrintWriter("notes.txt")empties the file first, and close finishes the writing.- Writing a file with PrintWriter (module 43, Writing files)
- try-with-resources, and objects in a file (module 43, Writing files)
- Drills in Deathmatch (topic: Writing files)
keywordprivateMakes a variable, constructor or method usable only inside its own class.
- Writing a class (module 17, Classes and objects)
- private, protected and public in a subclass (module 34, Inheritance and abstract classes)
- Access across packages (module 41, Packages and imports)
- Drills in Deathmatch (topic: Classes and objects)
procedural programming
ideaWriting a program as steps run one after another, with the work split into methods that get data as parameters.
- Procedural programs (module 27, Procedural and object-oriented programs)
- A command program, procedurally (module 27, Procedural and object-oriented programs)
- Drills in Deathmatch (topic: Procedural and object-oriented programs)
keywordprotectedMakes a member usable in its own class, its subclasses and the other classes of its package.
- private, protected and public in a subclass (module 34, Inheritance and abstract classes)
- Access across packages (module 41, Packages and imports)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
keywordpublicMakes a class or member usable from every class, in any package.
- Writing a class (module 17, Classes and objects)
- Access across packages (module 41, Packages and imports)
- Drills in Deathmatch (topic: Packages and imports)
methodpushPuts a value on top of a stack (pop takes the top one off, peek looks at it).
- Stacks and queues on linked nodes (module 59, Linked lists, stacks, queues and trees)
- ArrayDeque from the library (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
methodputStores a value under a key in a map, replacing the value the key had before.
- Keys and values (module 31, Hash maps)
- One value per key (module 31, Hash maps)
- Drills in Deathmatch (topic: Hash maps)
Q
quantifier
ideaIn a regular expression, a mark such as
*,+,?or{3}that says how many times the part before it may come.- Quantifiers and character classes (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: StringBuilder, regular expressions, enums and iterators)
queue
ideaA collection where values leave in the order they came, first in, first out.
- Stacks and queues on linked nodes (module 59, Linked lists, stacks, queues and trees)
- ArrayDeque from the library (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
R
classRandomMakes random numbers; with a seed, as in
new Random(42), it gives the same numbers on every run.- Random and nextInt (module 46, Random numbers)
- Seeds: the same numbers every time (module 46, Random numbers)
- Decimal numbers and chances (module 46, Random numbers)
- Drills in Deathmatch (topic: Random numbers)
keywordrecordDeclares a record, a class for plain data whose constructor, accessor methods, equals, hashCode and toString Java writes for you.
- Declaring a record (module 56, Records)
- Records as keys (module 56, Records)
- Class or record? (module 56, Records)
- Drills in Deathmatch (topic: Records)
record pattern
ideaA pattern that takes a record apart into its values, as in
case Point(int x, int y) ->(Java 21).- Record patterns (module 58, Pattern matching and sealed types)
- Drills in Deathmatch (topic: Pattern matching and sealed types)
recursion
ideaA method that calls itself on a smaller part of the problem, until a base case answers without a call.
- A method that calls itself (module 55, Recursion)
- Base case and return value (module 55, Recursion)
- Recursion on strings and arrays (module 55, Recursion)
- Drills in Deathmatch (topic: Recursion)
methodreduceCombines all of a stream's values into one, such as a sum,
.reduce(0, (a, b) -> a + b).- reduce, and IntStream (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
reference
ideaWhat a variable of an object type holds, the way to an object, not the object; two variables can refer to the same object.
- Reference variables (module 22, Primitive and reference variables)
- Values and references as parameters (module 22, Primitive and reference variables)
- One list, two names (module 14, For-each, list methods and lists in methods)
- Drills in Deathmatch (topic: Primitive and reference variables)
regular expression
ideaA pattern that describes a set of texts, such as
[0-9]+for one or more digits, checked with matches.- Regular expressions: matches, | and groups (module 39, StringBuilder, regular expressions, enums and iterators)
- Quantifiers and character classes (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: StringBuilder, regular expressions, enums and iterators)
methodremoveRemoves a value from a list, by its index or by the value itself; on a map, it removes a key and its value.
- Removing values (module 14, For-each, list methods and lists in methods)
- Drills in Deathmatch (topic: For-each, list methods and lists in methods)
classResultSetThe rows a database query returns, read one at a time with next and getString or getInt.
- A real database with JDBC (module 54, Libraries, Maven and databases)
- Drills in Deathmatch (topic: Libraries, Maven and databases)
keywordreturnEnds a method and hands a value back to the code that called it (a void method can return with no value).
- Returning a value (module 11, Return values and the call stack)
- Returning from branches (module 11, Return values and the call stack)
- Drills in Deathmatch (topic: Return values and the call stack)
return value
ideaThe value a method gives back to the code that called it, with return; its type is written before the method's name.
- Returning a value (module 11, Return values and the call stack)
- Computing the return value (module 11, Return values and the call stack)
- Drills in Deathmatch (topic: Return values and the call stack)
rounding errors
ideaA double can't hold most decimal fractions exactly, so
0.1 + 0.2prints 0.30000000000000004; count money in whole cents.- Money and rounding errors (module 18, Getters, toString and bigger classes)
- Drills in Deathmatch (topic: Getters, toString and bigger classes)
classRuntimeExceptionThe superclass of the unchecked exceptions other than Error and its subclasses, which a method doesn't have to catch or list after throws.
- Choosing what to catch (module 42, Exceptions)
- The details of an exception (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
S
classScannerReads text one line (or one piece) at a time, from what the user types,
new Scanner(System.in), or from a file.- Reading a line with Scanner (module 2, Reading input and strings)
- Reading a file line by line (module 20, Reading files)
- Drills in Deathmatch (topic: Reading input and strings)
classSceneWhat a JavaFX window shows, built around one root node, usually a layout with the components inside it.
- Scene, layout and components (module 48, GUI: windows, components and layouts)
- Switching between scenes (module 50, GUI: multiple views)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
keywordsealedLimits which classes may extend a class or implement an interface; they're usually listed after
permits, and anon-sealedone is open again.- Sealed interfaces (module 58, Pattern matching and sealed types)
- switch on sealed types (module 58, Pattern matching and sealed types)
- Drills in Deathmatch (topic: Pattern matching and sealed types)
seed
ideaThe starting number of a random number generator; the same seed gives the same numbers on every run.
- Seeds: the same numbers every time (module 46, Random numbers)
- Drills in Deathmatch (topic: Random numbers)
selection sort
ideaSorts by finding the smallest value, swapping it to the first place, then the next smallest to the second, and so on.
- Selection sort in code (module 28, Sorting and searching)
- Swapping, and sorting by hand (module 28, Sorting and searching)
- Drills in Deathmatch (topic: Sorting and searching)
classSetThe interface of collections that hold each value at most once.
- Java's Set interface and HashSet (module 35, Interfaces)
- Collection, and choosing between an interface and an abstract class (module 35, Interfaces)
- Drills in Deathmatch (topic: Interfaces)
methodsetOnActionGives a JavaFX button (or text field) the code to run when it's used, usually a lambda.
- Buttons that do something (module 49, GUI: event handling)
- Handlers that remember (module 49, GUI: event handling)
- Drills in Deathmatch (topic: GUI: event handling)
methodsetOnKeyPressedGives a JavaFX scene the code to run when a key is pressed; the event's code, such as
KeyCode.LEFT, says which key.- Steering with the keys (module 53, Project: an Asteroids-style game)
- Drills in Deathmatch (topic: Project: an Asteroids-style game)
methodsetOnMouseClickedGives a JavaFX node the code to run when it's clicked; the MouseEvent tells where.
- Drawing with the mouse (module 52, Drawing, images and sound)
- Drills in Deathmatch (topic: Drawing, images and sound)
methodShape.intersectGives the shape where two shapes overlap; when they don't, the width of its bounds is -1, which makes a collision test.
- Bumping into jellyfish (module 53, Project: an Asteroids-style game)
- Drills in Deathmatch (topic: Project: an Asteroids-style game)
methodsizeThe number of values in a list, set or map.
- The size of a list (module 13, Lists)
- Looping over a list (module 13, Lists)
- Drills in Deathmatch (topic: Lists)
methodsortedA stream step that puts the values in order, their natural order or a Comparator's.
- Steps in the middle: map, sorted, distinct, limit, skip (module 37, Streams and lambdas)
- Several criteria, and sorted streams (module 38, Ordering objects: Comparable and Comparator)
- Drills in Deathmatch (topic: Streams and lambdas)
methodsplitCuts a string into an array of parts at each match of a separator (a regular expression):
"a,b,c".split(",").- Splitting a string (module 16, Working with strings)
- Data in a fixed format (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
stack
ideaA collection where the last value put in is the first taken out, like a pile of plates.
- Stacks and queues on linked nodes (module 59, Linked lists, stacks, queues and trees)
- ArrayDeque from the library (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
stack trace
ideaThe lines a crash prints, which name the exception and every method call that led to it, with their line numbers.
- Bugs and troubleshooting step by step (module 26, Troubleshooting and unit testing)
- Reading a crash (module 12, Finding bugs)
- Drills in Deathmatch (topic: Finding bugs)
classStackOverflowErrorThrown when calls nest too deep for the call stack, usually a recursion that never reaches its base case.
- When recursion goes wrong (module 55, Recursion)
- Drills in Deathmatch (topic: Recursion)
classStageA JavaFX window; start is given the main one, and setScene puts what it shows in it.
- A first window (module 48, GUI: windows, components and layouts)
- Switching between scenes (module 50, GUI: multiple views)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
keywordstaticMakes a method or variable belong to the class itself rather than to its objects, so it's used without an object:
Math.sqrt(2).- Defining and calling a method (module 10, Methods and parameters)
- Procedural programs (module 27, Procedural and object-oriented programs)
- A first window (module 48, GUI: windows, components and layouts)
- Drills in Deathmatch (topic: Methods and parameters)
stream
ideaValues flowing through steps such as filter and map, to an end such as count, sum or collect; the collection itself doesn't change.
- Why streams: filter and count (module 37, Streams and lambdas)
- Ending a stream: count, sum, average, collect (module 37, Streams and lambdas)
- Steps in the middle: map, sorted, distinct, limit, skip (module 37, Streams and lambdas)
- Drills in Deathmatch (topic: Streams and lambdas)
classStringText, a sequence of characters in double quotes; a String never changes, so methods such as toUpperCase give a new string.
- String variables (module 2, Reading input and strings)
- Strings again (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
string
ideaA text value in double quotes, such as
"Hello", of the class String.- String variables (module 2, Reading input and strings)
- Strings again (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
methodString.formatBuilds a text from a template with places such as
%d,%sand%.2f, filled with the values given after it.- Text blocks and formatted text (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
classStringBuilderBuilds a text piece by piece with append, without making a new String every time; toString gives the result.
- StringBuilder: building a text piece by piece (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: StringBuilder, regular expressions, enums and iterators)
subclass
ideaA class that extends another class, its superclass, and inherits its methods.
- extends: a class built on another (module 34, Inheritance and abstract classes)
- Constructors and super(...) (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
methodsubstringGives a part of a string:
text.substring(2, 5)is from index 2 up to, not including, index 5, andtext.substring(2)the rest from 2.- Finding parts of a string (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
keywordsuperRefers to the superclass:
super(...)calls its constructor andsuper.name()its version of a method.- Constructors and super(...) (module 34, Inheritance and abstract classes)
- Overriding methods: @Override and super (module 34, Inheritance and abstract classes)
- Drills in Deathmatch (topic: Inheritance and abstract classes)
keywordswitchPicks the code to run, or the value to give, by matching one value against several cases.
- The switch statement (module 57, switch, var and text blocks)
- switch expressions and arrows (module 57, switch, var and text blocks)
- switch on strings and enums (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
switch expression
ideaA switch that gives a value, usually with arrow cases, as in
String name = switch (day) { case 1 -> "Mon"; default -> "?"; };.- switch expressions and arrows (module 57, switch, var and text blocks)
- switch on strings and enums (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
methodSystem.out.printfPrints text formatted from a template, as in
System.out.printf("%.2f%n", price); it adds no line break of its own, so end with%n.- Text blocks and formatted text (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
methodSystem.out.printlnPrints a value and then ends the line; System.out.print prints without ending it.
- Your first Java program (module 1, Printing)
- print and println (module 1, Printing)
- Drills in Deathmatch (topic: Printing)
T
test-driven development
ideaWriting a test before the code it tests, then the code that makes it pass, in small rounds (TDD).
- Test-driven development (module 26, Troubleshooting and unit testing)
- Drills in Deathmatch (topic: Troubleshooting and unit testing)
text block
ideaA string of several lines between three double quotes,
""", with the line breaks written as they are.- Text blocks and formatted text (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
text user interface
ideaThe part of a program that reads commands and prints answers, kept in its own class, apart from the program's logic.
- A class for the user interface (module 25, Separating the UI from program logic)
- The program's logic in a class (module 25, Separating the UI from program logic)
- Adding a feature (module 25, Separating the UI from program logic)
- Drills in Deathmatch (topic: Separating the UI from program logic)
classTextFieldA JavaFX box for one line of text the user types, read with getText; a TextArea holds several lines.
- Text fields and text areas (module 48, GUI: windows, components and layouts)
- Buttons that do something (module 49, GUI: event handling)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
keywordthisRefers to the object a method or constructor runs for, as in
this.name = name;this(...)calls another constructor of the class.- Parameters and this (module 18, Getters, toString and bigger classes)
- One constructor calling another (module 21, Designing classes and overloading)
- Drills in Deathmatch (topic: Getters, toString and bigger classes)
keywordthrowThrows an exception, as in
throw new IllegalArgumentException("negative price");.- Throwing an exception (module 42, Exceptions)
- The details of an exception (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
keywordthrowsLists in a method's header the exceptions it may throw to its caller; a checked exception must be caught or listed.
- Checked exceptions and throws (module 42, Exceptions)
- Exceptions and interfaces (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
methodtoStringGives an object as text; printing an object calls it, so a class writes its own toString to print well.
- toString (module 18, Getters, toString and bigger classes)
- Printing an object that holds a list (module 24, Lists inside objects)
- Drills in Deathmatch (topic: Getters, toString and bigger classes)
methodtoUpperCaseGives the string in capital letters (toLowerCase gives it in small letters); the original doesn't change.
- Strings again (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
classTreeMapA map that keeps its keys in sorted order, in a binary search tree; a TreeSet keeps a set's values the same way.
- TreeMap and TreeSet (module 59, Linked lists, stacks, queues and trees)
- Drills in Deathmatch (topic: Linked lists, stacks, queues and trees)
methodtrimGives the string without the spaces, tabs and line breaks at its start and end.
- Strings again (module 16, Working with strings)
- Drills in Deathmatch (topic: Working with strings)
keywordtryStarts a block whose exceptions the catch blocks after it handle.
- Catching an exception: try and catch (module 42, Exceptions)
- When the file is missing (module 20, Reading files)
- Drills in Deathmatch (topic: Exceptions)
try-with-resources
ideaA try with something to close in parentheses, such as
try (Scanner s = new Scanner(...)), which is closed when the block ends.- Exceptions and resources (module 42, Exceptions)
- Reading a file line by line (module 20, Reading files)
- try-with-resources, and objects in a file (module 43, Writing files)
- Drills in Deathmatch (topic: Exceptions)
two-dimensional array
ideaAn array of arrays, for a grid, as in
int[][] grid = new int[3][4], used asgrid[row][column].- A grid of values (module 47, Two-dimensional arrays)
- Going through a grid (module 47, Two-dimensional arrays)
- Drills in Deathmatch (topic: Two-dimensional arrays)
type
ideaWhat kind of value a variable holds, such as int, double, boolean or String; Java checks it before running the program.
- Variables and their types (module 3, Variables and types)
- Mixing input types (module 3, Variables and types)
- Drills in Deathmatch (topic: Variables and types)
U
unchecked exception
ideaA RuntimeException, one of its subclasses, or an Error, which a method doesn't have to catch or list after throws.
- Checked exceptions and throws (module 42, Exceptions)
- Throwing an exception (module 42, Exceptions)
- Drills in Deathmatch (topic: Exceptions)
unit test
ideaA small automatic check that one method or class gives the right results.
- Unit tests with JUnit (module 26, Troubleshooting and unit testing)
- More assertions and good tests (module 26, Troubleshooting and unit testing)
- Drills in Deathmatch (topic: Troubleshooting and unit testing)
V
methodvaluesGives a map's values, without their keys; on an enum,
values()gives all its constants.- Going through a hash map (module 31, Hash maps)
- Enums: a fixed set of values (module 39, StringBuilder, regular expressions, enums and iterators)
- Drills in Deathmatch (topic: Hash maps)
keywordvarLets the compiler work out a local variable's type from its starting value, as in
var names = new ArrayList<String>();.- var for local variables (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)
variable
ideaA named place for a value of a given type; giving it a new value replaces the old one.
- Variables and their types (module 3, Variables and types)
- Changing a value (module 3, Variables and types)
- Naming variables (module 3, Variables and types)
- Drills in Deathmatch (topic: Variables and types)
classVBoxA JavaFX layout that puts its components one under another in a column; an HBox puts them side by side in a row.
- HBox, VBox, spacing and GridPane (module 48, GUI: windows, components and layouts)
- Layouts inside layouts (module 48, GUI: windows, components and layouts)
- Drills in Deathmatch (topic: GUI: windows, components and layouts)
keywordvoidSays in a method's header that the method returns no value.
- Defining and calling a method (module 10, Methods and parameters)
- Returning a value (module 11, Return values and the call stack)
- Drills in Deathmatch (topic: Methods and parameters)
W
keywordwhileRepeats a block for as long as its condition is true, checking the condition before every round.
- while (true) and break (module 8, Repeating with while)
- while with a condition (module 9, Loop conditions and for)
- When the condition is checked (module 9, Loop conditions and for)
- Drills in Deathmatch (topic: Repeating with while)
classWritableImageAn image a program writes pixel by pixel with its PixelWriter, while a PixelReader reads the pixels of any image.
- Images as grids of pixels (module 52, Drawing, images and sound)
- Making an image smaller (module 52, Drawing, images and sound)
- Color filters (module 52, Drawing, images and sound)
- Drills in Deathmatch (topic: Drawing, images and sound)
X
classXYChart.SeriesOne named line or set of bars of a JavaFX chart, holding its points (XYChart.Data).
- A first line chart (module 51, Data visualization)
- Several series from a map (module 51, Data visualization)
- Drills in Deathmatch (topic: Data visualization)
Y
keywordyieldGives the value of a switch expression from a case with a block in braces or from a colon case.
- switch expressions and arrows (module 57, switch, var and text blocks)
- Drills in Deathmatch (topic: switch, var and text blocks)