FTC Programming

Hello World

Learn the basics of Java, TeleOp Programs, and Autonomous programs.

Getting Started

This documentation is designed to help you get your FTC bot fully programmed, from 0 experience. Let's get started.

Why Java?

FTC supports two ways to program a robot: Java or Blockly. Blocks is a drag-and-drop programming language, similar to Scratch. While it is easier for younger kids to understand, Java is the better option.

Hello World

This lesson is all about typing your very first line of Java to print this: Hello World. While you may be confused now, we will work backwards from this and get you familiarized with the language.

Code Editors/IDEs

Before we get started, for this whole section, you will need a Code Editor, or IDE. IDE stands for Integrated Development Environment. We recommend downloading VS Code or Atom.

Writing out the code

Finally, we can write our first line of code. Create a file called helloworld.java. Write the following code in your IDE.

public class helloworld
	public static void main(String[] args)
		System.out.println('Hello World!');

What exactly does that do?

The first line contains the class name, helloworld, which is also the name of the file. All Java needs to be run inside a class. The public means any other classes can access this class.

The second line creates a method, that can be called on its own, disregarding the helloworld class. static makes sure of this. void makes sure that this method doesn't return values. This method is called main. What is inside the parenthesis holds an array of strings (more on that later).

Finally, the line that prints 'Hello World'. System is a class that allows you to use useful methods and variables. out is a variable that allows the line to send an output. println is a method of out that allows you to print a line. And finally, inside the parenthesis, there are quotes and hello world. We will explain in the next lesson why we need the quotes.