Java Programming Basics#

Overview#
Java is an object-oriented, general-purpose programming language. Everything in a Java program is organized into classes — blueprints that define objects made up of variables (data) and methods (behavior).
Java is the primary language used for FRC robot programming through the WPILib library.
Java is case sensitive
Int and int are different things. drivetrain and Drivetrain are different things. Capitalization always matters.
Common Keywords#
These keywords appear constantly in Java code. Keep them in mind as you work through the sections below.
| Keyword | Meaning |
|---|---|
public |
Accessible by any other class |
private |
Accessible only within the class it is declared in |
protected |
Accessible within the class and any subclasses |
static |
Belongs to the class itself, not a specific object |
final |
Cannot be changed after it is first assigned |
void |
The method returns no value |
return |
Sends a value back to the caller and exits the method |
null |
Represents the absence of a value (nothing / empty) |
new |
Creates a new object from a class |
this |
Refers to the current object inside a class |
extends |
Inherits fields and methods from another class |
Knowledge Check#
Quiz results are saved to your browser's local storage and will persist between sessions.
Java is case-sensitive, meaning Drivetrain and drivetrain are treated as different things.
What does the final keyword do when applied to a variable?
In Java, a class is best described as:
Quiz Progress
0 / 0 questions answered (0%)
0 correct
What to Read Next#
The following pages each cover one core concept in depth, with FRC-focused examples throughout:
- Variables and Data Types — types, constants, scope, operators, naming conventions
- Methods — declaring methods, return types, parameters, calling methods
- Classes and Objects — fields, constructors, inheritance,
@Override