3.1-Understanding Java Operators Flashcards

1
Q

What is a Java operator?

A

A Java operator is a special symbol that applies an operation to a set of values, literals, or variables, —referred to as operands—and returns a result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an operand?

A

The term operand, refers to the value, literal or variable an operation is applied to via an operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is call the output of the operation?

A

It’s simply referred to as the result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Are Java operators evaluated from left-to-right order?

A

Not necessarily, they follow the pre-defined Order of operator precedence.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Operator Precedence?

A

Determines what order operators should be evaluated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What can alter the Operator precedence?

A

parentheses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

🤯️⚠️📣️ What are the Operators precedence?

A
0°Parentheses: ()-
1° Unary: (***Post), Pre, ~, !, +, -
2° Arithmetic: *, /, %, +, -  (***Numeric Promotion)
3° ShiftBitwise: >>, <>>
4° Relational: , >=, (***instanceof)
5° Comparisson: ==, !=
6°  Logical(Bitwise and Short-circuit): &, |, ^, &&, ||
7° Ternary: ? :
8° Assignment: =, +=, -=, *=, /= 
    -> ⚠️Internal Type casting
    -> ⚠️Unperformed Side Effects
    -> ⚠️Composed Assignment ❌(Inline-declaration)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to change the operation precedence?

A

By wrapping parentheses around the sections we want
to be evaluated first.

⚠️📣️ Make sure they are always valid and balanced.
✅Only parentheses ( ) ❌ [ ], < >, \ /, { }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly