We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Day 2: Operators

# Day 2: Operators

Terms you'll find helpful in completing today's challenge are outlined below, along with sample Java code (where appropriate).

**Operators**

These allow you to perform certain operations on your data. There are 3 basic types:

*Unary*: operates on 1 operand*Binary*: operates on 2 operands*Ternary*: operates on 3 operands

**Arithmetic Operators**

The binary operators used for arithmetic are as follows:

`+`

: Additive`-`

: Subtraction`*`

: Multiplication`/`

: Division`%`

: Remainder (modulo)

**Additional Operators**

`+`

: A binary operator used for String concatenation`++`

: This unary operator is used to*preincrement*(increment by 1 before use) when prepended to a variable name or*postincrement*(increment by 1 after use) when appended to a variable.`--`

: This unary operator is used to*predecrement*(decrement by 1 before use) when prepended to a variable name or*postdecrement*(decrement by 1 after use) when appended to a variable.`!`

: This unary operator means*not*(negation). It's used before a variable or logical expression that evaluates to true or false.`==`

: This binary operator is used to check the*equality*of 2 primitives.`!=`

: This binary operator is used to check the*inequality*of 2 primitives.`<`

,`>`

,`<=`

,`>=`

: These are the respective binary operators for*less than*,*greater than*,*less than or equal to*, and*greater than or equal to*, and are used to compare two operands.`&&`

,`||`

: These are the respective binary operators used to perform*logical AND*and*logical OR*operations on two boolean (i.e.: true or false) statements.`? :`

This ternary operator is used for simple conditional statements (i.e.: if ? then : else).