Skip to content
50 changes: 50 additions & 0 deletions examples/stage0/snippets/operators.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2026 FRCSoftware
*
* SPDX-License-Identifier: BSD-3-Clause
*/
// [variables]
int answer1 = 2 + 4;
int answer2 = 6 / 3;
int answer3 = 10 - 3;
// [/variables]

void main() {
// [multiplication]
int Number = 6;
System.out.print(Number * 2);
// [/multiplication]

// [increments]
int x = 6;
int y = 7;

System.out.println(++x);
System.out.println(--y);
// [/increments]

// [arithmetic]
int A = 10;
int B = 5;
A += 1;
B -= 1;

System.out.println(A); // prints 11
System.out.println(B); // prints 4
// [/arithmetic]

// [comparison]
int C = 2;
int D = 4;
System.out.print(A > B);
// [/comparison]

// [logical]
boolean AnswerOne = 5 > 3; // True
boolean AnswerTwo = 9 < 2; // False

System.out.println(AnswerOne && AnswerTwo);
System.out.println(AnswerOne || AnswerTwo);
System.out.println(!AnswerOne);
// [/logical]
}
12 changes: 8 additions & 4 deletions src/config/sidebarConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export const sidebarSections: Record<string, SidebarSection[]> = {
label: 'Java Fundamentals',
slug: 'learning-course/intro-to-java/java-fundamentals',
},
// {
// label: 'Operators',
// slug: 'learning-course/intro-to-java/operators',
// },
{
label: 'Operators',
slug: 'learning-course/intro-to-java/operators',
},
// {
// label: 'Conditionals',
// slug: 'learning-course/intro-to-java/conditionals',
Expand Down Expand Up @@ -281,6 +281,10 @@ export const sidebarSections: Record<string, SidebarSection[]> = {
label: 'Java fundamentals',
slug: 'intro-to-java/java-fundamentals',
},
{
label: 'operators',
slug: 'intro-to-java/operators',
},
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ UP_POSITION is a double that holds the value -33.5 and DOWN_POSITION is a double

<Aside type="note">
In FRC, we tend to avoid print statements and instead have other methods of debugging code, which we will talk about in a later section.
However, for this section of the course we will use print statments.
However, for this section of the course we will use print statements.

</Aside>

Expand Down Expand Up @@ -120,7 +120,7 @@ In Java, there are two types of comments: single-line comments and multi-line co
### Single-line Comments

Single line comments begin with `//` and mark the rest of the line as being a comment.
For example, the code below leave the note of "This prints out Hello World." above the print statment
For example, the code below leave the note of "This prints out Hello World." above the print statement

```java stage0/snippets/JavaFundamentals.java#singleLineComment

Expand Down
Loading
Loading