Skip to content

Stage 0: Add Java fundamentals exercises#81

Draft
CodeMyGame1 wants to merge 5 commits into
frcsoftware:mainfrom
CodeMyGame1:stage0-exercises
Draft

Stage 0: Add Java fundamentals exercises#81
CodeMyGame1 wants to merge 5 commits into
frcsoftware:mainfrom
CodeMyGame1:stage0-exercises

Conversation

@CodeMyGame1

@CodeMyGame1 CodeMyGame1 commented Jul 8, 2026

Copy link
Copy Markdown

Description

Adds exercises for stage 0 (Java Fundamentals), to complement the stage 0 lessons being built up.

Meta

Merge checklist:

Comment thread stage0/solution/Operators.java Outdated

// Create an integer variable `quotient1`, and assign to it the value
// of 5 divided by 3. Then print the value of `quotient1`.
double quotient1 = 5 / 3;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 2027, WPILib has a compiler plugin that will throw a compile-time error if someone tries to do this.

So, make it an int instead (and let people know that regular java doesn't error when you do integer division like this).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it will throw an error, I still think it's valuable to showcase what happens here to better explain why there's an error and why it's problematic. Plus, I don't want to include something that's wrong in normal java, even if wpilib makes it not wrong, in a way.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean converting quotient1 to an int is wrong, or that keeping it as a double is wrong in normal Java?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant keeping it as a double, my bad.

My main concern is that this code doesn't pass CI (also, y'all got it backwards: it's wrong in WPILib java, but not in normal java).

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🌐 Preview URL: https://pr-81.frcsoftware.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants