Anda di halaman 1dari 9

Java Fundamentals for Android Development

Lesson 1
Java Overview
Operators
Equality and Relational Operators
The equality and relational operators determine
if one operand is greater than, less than, equal
to, or not equal to another operand.

== equal to
!= not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to
Conditionals Operators
The && and || operators perform
Conditional-AND and Conditional-OR operations
on two boolean expressions.

These operators exhibit "short-circuiting"


behavior, which means that the second operand
is evaluated only if needed.

&& Conditional-AND
|| Conditional-OR
Conditionals Operators
If you want to evaluate each member of
expression you should use:

& Conditional-AND
| Conditional-OR

You should be carefully because if your logic is


expecting to stop in an validation a
nullPointerException could be reached.
Conditionals Operators
Another conditional operator is ?:,

Is a shorthand for an if-then-else statement.

This operator is also known as the ternary


operator. You have in a single line all
functionality of a if-then-else statement.
References
https://www.tutorialspoint.com/java/java_quick_guide.htm
https://docs.oracle.com/javase/tutorial/java/data/strings.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/flowsummary.html
https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html

Anda mungkin juga menyukai