Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cheat sheet patc #98

Merged
merged 4 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/config/.wordList.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
allwpilib
APCSA
AppData
BobSaidHi
boolean
CMD
Codecademy
CodeHS
codespaces
Codespaces
Codewars
Expand All @@ -25,16 +28,21 @@ gifs
github
gitignore
gmail
helloArray
helloString
html
https
Javacademy
Javadoc
JavaDoc
JDK
JDK's
JDKs
Kanban
linter
markdownlint
md
Multiline
MXP
NavX
octocat
Expand All @@ -45,6 +53,9 @@ orgs
PCM
PDP
PID
pre
println
programiz
py
README
README's
Expand All @@ -61,10 +72,13 @@ SPX
SRX
steelboot
Steelboot
substring
TalonSRX
Trayford
Trayford's
txt
UI
Unicode
USERPROFILE
VCS
VictorSPX
Expand All @@ -88,6 +102,3 @@ WRRF
www
yaml
yml
programiz
CodeHS
Trayford's
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"declutter",
"gmail",
"Javacademy",
"Javadoc",
"Kanban",
"Libj",
"markdownlint",
Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ include:
- gitHubAdmin/teams.md
- hardware/statusLights.md
- index.md
- legacyTutorials.md
- quickStart/codingWorkflow.md
- quickStart/gitHubDesktopTut.md
- quickStart/introToGit.md
Expand Down
58 changes: 2 additions & 56 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,64 +44,10 @@ Ms. Trayford's lectures from her class may also be useful.
[2021-22 Basic Java I GitHub Classroom Assignment Invite](https://classroom.github.com/a/TYpIZLPz)
2021 Basic Java II - Coming soon

#### Legacy Tutorials
[Legacy Tutorials](legacyTutorials)

> These may not be supported.

[2019 Code Tutorial Week 1 Presentation](https://docs.google.com/presentation/d/1sOFl91aIioVyXvMVSft5d-G8KnanIeMLz-Xw4ExZkkM/edit?usp=sharing)

[2019 Code Tutorial Week 2 Presentation](https://docs.google.com/presentation/d/1cXLZEkoNqcRwhaLwBg9RvNKQzxm8zYvOxBlgxwa6Be8/edit?usp=sharing)

(Other 2019 Presentation lost - contact `x64-bit` or `s3ash3lls`)

##### Breaker Bots (FRC #5104) Javacademy Tutorials

> A few years ago (2019), the Breaker bots from Pacific Grove ran a summer workshop series. These links have been retrieved from emails and the last version (no longer live) of their summer lesson web page, the source of which can be found [here](https://github.com/BreakerBots/Breakersite/blob/c7b93221ee02210e65e9ac10582f90ee2ebe21aa/src/pages/summer_lessons.html).

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 1](https://docs.google.com/presentation/d/1ek36GlI8aiDOuYtB3BftqrIr-H69X6U3gikNIL-Mg4w/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 1](https://docs.google.com/document/d/1oTV9E9kgcH1m48e4CjyxbVSXgAg4-E97QX2pgv8VdLM/edit)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Practice Solutions](https://github.com/BreakerBots/Javacademy/tree/master/Javacademy%20Week%202)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 2](https://docs.google.com/presentation/d/1xgHaPwMhwNigjtHWB4ChHoZXxngItr9LPT5-sfxm09U/edit?usp=sharing)

<br>

[Breaker Bots (FRC #5104) - Javacademy Week 3)](https://docs.google.com/presentation/d/1E3z-LQPFoK5SgpAw4g1xmu4TmGPwPASxlpwc1G2MqkQ/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 2](https://docs.google.com/document/d/11qnqcND6TGiHUmZ5cNQWMYxvsnx5BEYQp6T0pXQIK3M/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Week 4 - Cheat Sheet & Projects 1 & 2](https://docs.google.com/document/d/1q7zudOTuQefEMARWO5JlAKtnoUETJOpDzlKEpGZYNRM/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 5](https://docs.google.com/presentation/d/1qq5nIkcwCa-6Uu0ksKJAZwR34r0KvhS-AbbyMGg6voY/edit)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 3](https://docs.google.com/document/d/1xfW6f3-dt7i5oFtpXvCNwyq5msHTBfX6VFE_XgYP5qI/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 6)](https://docs.google.com/presentation/d/1cnE6B4xdNqegelAMnZsJawAu-FuBgLgTXQjUIn-zGIA/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 7](https://docs.google.com/presentation/d/1N-bDwqEA3dgI9k0X4MwQWSnehP-PS33TcUhUvoRmipU/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 4](https://docs.google.com/document/d/1yKloKXCf9H0-YejyF1UdUXh0bWfEv8BZIZbftAv4Gbw/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 5)](https://docs.google.com/document/d/1rSFMM3Z19Psa_9JnpJb5y0ro1cQ-5mRCESbax328hcU/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 8 - Cheat Sheet 2)](https://docs.google.com/presentation/d/1N-bDwqEA3dgI9k0X4MwQWSnehP-PS33TcUhUvoRmipU/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 3)](https://docs.google.com/document/d/1xfW6f3-dt7i5oFtpXvCNwyq5msHTBfX6VFE_XgYP5qI/edit?usp=sharing)

## Introduction to `git` and GitHub

This section includes information about GitHub
Expand Down Expand Up @@ -215,4 +161,4 @@ Assorted WPLib-j resources.

<br>

_Updated 20211031T1500 PDT_
_Updated 20211103T2245 PDT_
181 changes: 181 additions & 0 deletions java/JavaICheetSheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Java I Cheat Sheet

## Comments

<table>

<tr>
<td>Explanation</td>
<td>Example</td>
</tr>

<tr>
<td>Single</td>
<td>

```Java
// comment text
```

</td>
</tr>

<tr>
<td>Multiline (Basic)</td>
<td>

```Java
/*
comment text
*/
```

</td>
</tr>

<tr>
<td>Multiline Javadoc</td>
<td>

```Java
/**
* comment text
* @author BobSaidHi
*/
```

</td>
</tr>

</table>

### Table of Javadoc tags

[Oracle Docs - Javadoc info](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html)

[Complete list](https://www.tutorialspoint.com/java/java_documentation.htm)

| Tag | Explanation |
|---|---|
| `@author` | Author tag |
| `@version` | Version tag |
| `@param` | Explains one of the method's parameters |
| `@return` | Explains what the method returns |
| `@see` | References more information |
| `@since` | When something was first implemented |
| `@deprecated` | Deprecated tag |

## Primitives (Basic Variables)

### Example with an integer

```Java
// Multiple Statements
int i;
i = 0;

// Single Statement
int i = 0;
```

[Complete List of Primitives](https://en.wikibooks.org/wiki/Java_Programming/Primitive_Types)

### Table of Primitives

| Use | Symbol/ Keyword | Explanation |
|---|---|---|
| integer | `int` | Holds a 32-bit integer. There are also other primitives that can hold integers (`byte`, `short`, and `long`). |
| character | `char` | Can hold 1 Unicode character. Can be treated as a special int |
| decimal | `double` | Holds a double precision floating point number, which a way to store a decimal. There are also one other primitives that can hold decimals (`float`). |
| boolean | `boolean` | Holds a boolean value (`true` OR `false`) |
| no return | `void` | In a method declaration, a return type of `void` means that nothing will be returned. |

> Note: Arrays are indicated with brackets.

## Math Operations

[Order of operations](https://introcs.cs.princeton.edu/java/11precedence/)

| Name | Example | Explanation|
|---|---|---|
| Parentheses | `(A)` | A is in parentheses |
| Multiplication | `A * B` | A multiplied by B. |
| Division | `A / B` | A divided by B. |
| Addition | `A + B` | A plus B. |
| Subtraction | `A - B` | A minus B. |
| Modulus | `A%B` | Gives the remainder of `A / B` |

Also, `+=`, `-=`, `*=`, and `/=` allow one to perform an an operation on a variable then then assigning the result to said variable.

### Special Loop Operators

| Example | Action | Explanation |
|---|---|---|
| `A++` | post-increment | |
| `A--` | post-decrement | |
| `++A` | pre-increment | |
| `--A` | pre-decrement | |

### Math Class

| Name | Symbol | Explanation|
|---|---|---|
| Exponents | `Math.pow(base, exponent)` | Import the `Math` class by typing `import java.lang.Math`, then...

## Strings (Fancy Variables)

A `String` is a special type of variable, because it is actually an object that is implemented as a `char` array. The first character will receive an index of `0`. When you write one, using double quotes, that is called a String literal. [More info](https://docs.oracle.com/javase/tutorial/java/data/strings.html)

```Java
// Create a String variable from a String literal
String s = "I'm a String";

// Create a String using a constructor:
char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.' };
String helloString = new String(helloArray);
System.out.println(helloString);

```

[APCSA Java Quick Reference](https://apstudents.collegeboard.org/ap/pdf/ap-computer-science-a-java-quick-reference_0.pdf)

`String` Methods:
| Method | Explanation |
|---|---|
| `int length()` | Returns the number of characters in a `String` object |
| `String substring(int from, int to)` | Returns the substring beginning at index `from` and ending at index `to - 1` |
| `String substring(int from)` | Returns `substring(from, length())` |
| `int indexOf(String str)` | Returns the index of the first occurrence of `str`; returns `-1` if not found |
| `int compareTo(String other)` | Returns a value `<0` if this is less than `other`; returns `0` if `this` is equal to `other`; returns a value `>0` if `this` is greater than `other` |

## Print Statements

[Javadoc for `System.out`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#out)

```Java
// Print something out
System.out.print("I'm a String");

// Print something out and add a line break
System.out.println("I'm a String");

// Concatenating a String and a integer
System.out.println("Five as a number is: " + 5);


```

> Please note that "I'm a String" (including the quotes) can be replaced by almost anything, including other data types, variables, and even some objects.

## Escape Sequences

[Further Reading](https://www.informit.com/articles/article.aspx?p=30241&seqNum=3)

| Sequence | Meaning |
|---|---|
| `\` | Open escape sequence |
| `\t` | tab |
| `\n` | line break (new line) |
| `\"` | Allows the use of double quotes in a String |
| `\'` | Allows the use of a single quot in a char |
| `\\` | Allows the use of a backslash in text
63 changes: 63 additions & 0 deletions legacyTutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Legacy Tutorials

> This page references material that may not be supported.

## 6506 Coding Workshops 2019

[2019 Code Tutorial Week 1 Presentation](https://docs.google.com/presentation/d/1sOFl91aIioVyXvMVSft5d-G8KnanIeMLz-Xw4ExZkkM/edit?usp=sharing)

[2019 Code Tutorial Week 2 Presentation](https://docs.google.com/presentation/d/1cXLZEkoNqcRwhaLwBg9RvNKQzxm8zYvOxBlgxwa6Be8/edit?usp=sharing)

(Other 2019 Presentation lost - contact `x64-bit` or `s3ash3lls`)

## Breaker Bots (FRC #5104) Javacademy Summer 2019

> A few years ago (2019), the Breaker bots from Pacific Grove ran a summer workshop series. These links have been retrieved from emails and the last version (no longer live) of their summer lesson web page, the source of which can be found [here](https://github.com/BreakerBots/Breakersite/blob/c7b93221ee02210e65e9ac10582f90ee2ebe21aa/src/pages/summer_lessons.html).

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 1](https://docs.google.com/presentation/d/1ek36GlI8aiDOuYtB3BftqrIr-H69X6U3gikNIL-Mg4w/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 1](https://docs.google.com/document/d/1oTV9E9kgcH1m48e4CjyxbVSXgAg4-E97QX2pgv8VdLM/edit)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Practice Solutions](https://github.com/BreakerBots/Javacademy/tree/master/Javacademy%20Week%202)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 2](https://docs.google.com/presentation/d/1xgHaPwMhwNigjtHWB4ChHoZXxngItr9LPT5-sfxm09U/edit?usp=sharing)

<br>

[Breaker Bots (FRC #5104) - Javacademy Week 3)](https://docs.google.com/presentation/d/1E3z-LQPFoK5SgpAw4g1xmu4TmGPwPASxlpwc1G2MqkQ/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 2](https://docs.google.com/document/d/11qnqcND6TGiHUmZ5cNQWMYxvsnx5BEYQp6T0pXQIK3M/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Week 4 - Cheat Sheet & Projects 1 & 2](https://docs.google.com/document/d/1q7zudOTuQefEMARWO5JlAKtnoUETJOpDzlKEpGZYNRM/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 5](https://docs.google.com/presentation/d/1qq5nIkcwCa-6Uu0ksKJAZwR34r0KvhS-AbbyMGg6voY/edit)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 3](https://docs.google.com/document/d/1xfW6f3-dt7i5oFtpXvCNwyq5msHTBfX6VFE_XgYP5qI/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 6)](https://docs.google.com/presentation/d/1cnE6B4xdNqegelAMnZsJawAu-FuBgLgTXQjUIn-zGIA/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 7](https://docs.google.com/presentation/d/1N-bDwqEA3dgI9k0X4MwQWSnehP-PS33TcUhUvoRmipU/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 4](https://docs.google.com/document/d/1yKloKXCf9H0-YejyF1UdUXh0bWfEv8BZIZbftAv4Gbw/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 5)](https://docs.google.com/document/d/1rSFMM3Z19Psa_9JnpJb5y0ro1cQ-5mRCESbax328hcU/edit?usp=sharing)

<br>

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Week 8 - Cheat Sheet 2)](https://docs.google.com/presentation/d/1N-bDwqEA3dgI9k0X4MwQWSnehP-PS33TcUhUvoRmipU/edit?usp=sharing)

[(Deprecated) Breaker Bots (FRC #5104) - Javacademy Exercises - Set 3)](https://docs.google.com/document/d/1xfW6f3-dt7i5oFtpXvCNwyq5msHTBfX6VFE_XgYP5qI/edit?usp=sharing)

<br>

_Updated 20211103T2245 PDT_