Java Bootcamp – Workbooks and Challenges

Cheat Sheet

This cheat sheet contains the most important takeaways that lead up to section four.

1. Getting Started

  • class: contains all of your code.

  • main(): entry point of your app.

  • javac <file-name>.java: compiles your code.

  • java <file-name>: runs the compiled code.

2. Variables

Data types

There are 6 main data types.

long can store very big numbers. But, int is faster and takes less memory.

Math Operators

Put math operations in brackets if you wish to embed them inside a String.

  • Example: "5 + 2 is " + (5 + 2);

3. Booleans and Conditionals

Comparison Operators

Put comparison operations in brackets if you wish to embed them inside a String.

  • Example: "Five is not smaller than one. I'm certain this is " + (5 < 1);

Rules of thumb

When controlling how your code runs:

  • use switch to compare one value against a list of values.

  • in any other scenario, use if-else.

Do not confuse = with ==

  • use = to set a value equal to another.

  • use == to compare two values and return a boolean.

4. Functions

Function Parts

  1. Level of access: private, public.

  2. Return type: double, int, boolean, char, String, long.

  3. Function name: lowerCamelCase (singChorus, kickBall).

  4. Parameter: value received by the function.

  5. Argument: value passed into the function.

  6. Code: performs your task.

  • return breaks the entire function. Nothing after it can run.

Rule of thumb: if a function calculates a value, return it.


^**The default delimiter is white space.^

Coding Pitfalls

Good coding habits


  • class: CamelCase.

  • variable: lowerCamelCase.

  • function: lowerCamelcase.

Tips and tricks


  • Use the up key to run previous terminal commands.

  • Write clear to clear the terminal output.

  • Press the tab key for auto-complete.

Escape characters

  • \n adds a new line of space.

  • \t adds a new tab of space.

Shortcut keys

  • Use CMD/Ctrl+/ to comment a highlighted piece of code.

  • In Visual Studio Code, use sysout as a shortcut to System.out.println()

Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer

Feedback Summary
43 students





Written Reviews
There are no written reviews yet.