Skip to content

0. Java Basics

If you are not yet proficient enough to pass the AP Computer Science A test, you should take the Codecademy Java course found here: https://www.codecademy.com/learn/learn-java

This course will walk you through the basics of Java and Object Oriented Programming that you will need for FRC programming. It will take, at minimum, three weeks of worksession time, split up into the following sections:

Week 1:

  • Hello World
  • Variables
  • Object-Oriented Java

Week 2:

  • Conditionals and Control Flow
  • Arrays and ArrayLists
  • Loops

Week 3:

  • Access, Encapsulation, and Static Methods
  • Inheritance and Polymorphism
  • Debugging

Warning

Do not do the "Advanced Programming" section right away as a new programmer; it's not necessary and will slow you down.

Other Notes

For Inheritance and Polymorphism, a concept they do not cover are interfaces which you may encounter. Read about them here.

They also do not cover enums. Read more about them here. One thing they don't mention is that you can actually assign values to your enums such as:

public static enum TemperatureLimit {
    NEO(70), NEO_550(40);

    public final int limit;

    private TemperatureLimit(int limit) {
        this.limit = limit;
    }
}

JavaDocs

Java has a standard documentation format that is autogenerated from documentation comments in the code. We will be referencing them extensively to write our code.

On top of a JavaDoc contains a description of the class, its package, what it inherits, and more. Below that is a section containing the class' constructors, and the section below contains the methods you can call from that class. If you click on any of the constructors or methods, you get directed to a section with more details about what you clicked. Here's a JavaDoc of a class you should be familiar with: ArrayList. It may seem like a huge info dump, but only look for the relevant parts of the JavaDoc. If you are trying to find a specific method, don't look through construtors and other nonrelevant details.

In some cases, it may be better to go on the website describing the class instead of going to the javadoc directly. Javadocs only cover how to use it in code, while the website may give a lot more description on when to use it, why to use it, etc. You can find these websites by just searching the class name and making sure its the correct class. For example, here is the website description of ArrayList and here is the javadoc of ArrayList. I highly suggest to look at the website or tutorials online if you don't understand the javadoc.

If you still don't get it, you can always ask a programming veteran for help!

Unfinished

If you see this, tell a programming veteran to add exercises