Beruflich Dokumente
Kultur Dokumente
The int data type onlu allows values between -2.147.483.648 +2.147.483.647
All char values must be enclosed in single quotes, like this : 'G'.
Variables
1. A variable stores a value
Comments
A comment is a text that you want Java to ignore. Comments allow you to describe code or keep notes.
2. Multy-line comments.
/*
this is
multy-line
comment
*/
Math :
+, -, /, *
Relational Operators
< : less than.
Equality Operators
== : equal to.
Generalization
Data Types are int, boolean, and char.
Variables are used to store values.
Whitespace helps make code easy to read for you and others.
It will returns a boolean valeu of True only if both sides of the expressions are
true.
Boolean Operators : ||
The or operator is represented in Java by ||.
It returns a boolean value of True if at least one side of the expression is true.
Boolean Operators : !
The not operator is represented in Java by !.
It will return false if the expresion is true , and true if the expresion is false.
If Statement
In Java the keyword if is the first part of a conditional expression.
It is followed by a boolean expression and the a block of code. If the Boolean expression evalua
tes to true, the block of code that follows will be run.
If-Else Statement
The if/else conditinal will run the block of code associated with the if statement if its Boolean expresion
evaluates to True.
Otherwise, if the expression evaluates to false, it will run the block of code after the else keyword.
If-ElseIf-Else Statement:
If the Boolean expresion after if statement evaluates to true, it will run the code block that directly
follows.
otherwise, if the Boolean expresion after else if evaluates to true, the code block that directly follow will
run.
Finnaly if all previous Boolean expresions are evaluated to false, the code with the else block will run.
Tenary Conditional
The term tenary comes from a Latin word that means "composed of three parts"
A Boolean expression.
The default case is printed only if restaurant Rating is not equal to an int with the value of 1 2 or 3.