Intro to FRC Programming - Romi
  • INTRODUCTION
    • Overview
    • Important Links
  • 💽Setup
    • Setting up the Romi's Software
    • Downloading Essential Tools
    • APCS vs FRC
  • How To Code in VSC
    • VSC- Intro
    • A Tour Through VSC
    • Creating a Regular Java Project
  • Intro to Java
    • What is Java?
    • Beginning Steps
    • 🟩Fundimentals of Java
      • Variables
      • Operations
      • Methods
      • Comments
      • If Statements and Conditions
      • Boolean Zen
      • Loops
      • Challenge- Create a Box House
    • 🟨Advanced Concepts
      • Objects
      • Scanners
      • Null Objects
      • Arrays
      • Errors
      • For-Each Loops
    • 🟥Object Oriented Programming
      • Basics of OOP
      • Instance Classes
      • Static Classes
  • 🕑Romi Curriculum- Timed Base
    • Romi Curriculum- Introduction
    • Creating a WPILIB Project
    • Running Your Code
    • The Robot Class
    • Subsystems
      • RomiDrivetrain
    • Cool stuff i will rename this category later
      • Spark Motors
      • PIDs
      • External Controllers
      • Encoders
  • 🖥️Romi Curriculum- Command Based
    • Command Based Code
    • RobotContainer
    • Commands
    • CommandScheduler
  • UNRELATED IMPORTANT CODING KNOWLEDGE
    • Constants
  • SAMPLE CODE
    • Tank Drive Example
      • RobotContainer
      • TankDriveSubsystem
      • MoveRobotCommand
    • Worktop Systems Sample Java Code
      • Belt Elevator Sample Code
      • Rotating Arm Sample Code
Powered by GitBook
On this page
  • Tour of Java
  • Main Method
  • Running Your Code
  • Print Statements
  • System.out.print(your text here)
  • System.out.println(your text here)
  • Challenge— Write your First Code
  1. Intro to Java

Beginning Steps

PreviousWhat is Java?NextFundimentals of Java

Last updated 1 month ago

Tour of Java

Take a look through your App.java class. Yeah— it's only around 5 lines of code. But we'll fix this. All of your code is put into classes. Classes are like the blueprints of your code— they define your code's purpose. We'll go into more detail much later.

Main Method

Most programming languages require a starting point for their code when it's run. For Java, it's the main method. If you look at your App.java file, the main method is the only thing inside your App class.

Running Your Code

If you look at the main method, you might notice the Run | Debug stuff above it. If you want to run your code, click this. You could also click the arrow next to the Command Palette to run it. Click the "Run" button below and see what happens.

Well— nothing happens. Except that a cool window appears on the bottom of your screen (obviously, since there's no code yet). Sorry about that. Let's fix this by writing our first line of code!

Print Statements

Print statements log a single line into the terminal— that cool window that just opened. They're primarily used for debugging, which is using strategies to fix errors in your code.

There are two types of print statements:

System.out.print(your text here)

All this does is print whatever's in its parameters (data in the parenthesis) into the terminal, and nothing else.

System.out.println(your text here)

This is similar to System.out.print() except that after the text is printed, the pointer goes down a line. It's like writing a sentence then going down a line.

Challenge— Write your First Code

Throughout this entire GitBook you'll encounter tons of different challenges such as this one. All the requirements are given below, plus hints if needed. Since this "challenge" is more of a rite of passage, I won't be giving the solution or any hints.

All you'll need to do is:

If you wrote it down in your print statement and ran your code, "Hello World!" should appear in your terminal. If it does— great job! You just completed the coders' rite of passage.