Upload
mr-ahmed-elmasry
View
221
Download
0
Embed Size (px)
Citation preview
7/30/2019 Java_Chapter02_Review
1/14
--| P a g e
FanniaBackboneJava Course:/10/10/3102 http://fanniabackbone.wikispaces.com/Java
4 / 28 /
"". Java:
Chapter 02: Variables &Constants.:
Java:Data Types:
:Constatns:ConstantJava
Runtime.:
. ," Identifiers." .
Example :
http://fanniabackbone.wikispaces.com/Javahttp://fanniabackbone.wikispaces.com/Javahttp://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/Java7/30/2019 Java_Chapter02_Review
2/14
-2-| P a g e
:Variables:
Data Types" Address " , ,.
intx = 10 ;
inty = 13 ;intt = x + y;
:Variables Naming .
Keyword. {_ , |$}. unique
Scope
..
DescriptiveName.
Examples oflegal identifiers:
age, $salary, _value , __1_value
Examples ofillegal identifiers :
123abc , -salary , new , public ,first No
Data Types:
:
DATATYPES
REFRENCE
TYPE
VALUE TYPES
10 13 23
tName
intType
23Vaue
String
Scanner
7/30/2019 Java_Chapter02_Review
3/14
-3-| P a g e
char boolean
byte short int long
double float
http://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/http://fanniabackbone.wikispaces.com/http://sketchup.google.com/3dwarehouse/search?uq=0769425665695756779831361&scoring=mhttp://sketchup.google.com/3dwarehouse/download?mid=fcfedbea324a3eced761679f5909421c&rtyp=lt&ctyp=other&ts=1355601128000http://fanniabackbone.wikispaces.com/7/30/2019 Java_Chapter02_Review
4/14
-4-| P a g e
int
4 * 8 = 32 // from
byte
1 * 8 = 8 // from
short
2 * 8 = 16 // from
long
8 * 8 = 32 // from
double
7/30/2019 Java_Chapter02_Review
5/14
-5-| P a g e
float
char
boolean
true or false
7/30/2019 Java_Chapter02_Review
6/14
-6-| P a g e
:Output Methods
System
.out.println("H
ello!");
Methodsin
print()
println()printF()
object
inout
class
inSystem
packagejava.lang
7/30/2019 Java_Chapter02_Review
7/14
-7-| P a g e
:
EscapeSequence
Description
\t Tab
\b Backspace
\n Newline
\r Carriage Return
\f Formfeed
\' Single Quote
\" Double Quote
\\ Backslash
System.out.println ("She said \"Hello!\" to me.");She said "Hello!" to me.
:Comments
.
.
// Single Line Comment
/**/
Multi Line Comment
/***/
Docx.
7/30/2019 Java_Chapter02_Review
8/14
-8-| P a g e
:Input Methods
:
nextInt()
nextDouble()
next()nextLine()
new Object Scanner class
Java.util package
7/30/2019 Java_Chapter02_Review
9/14
-9-| P a g e
:
Some
OperatorsDescription
= Assign
+ Add , Concat ,Postive
-Subtract ,
Minus
* Multiply
/ Div
% Reminder
++ Increment-- Decrement
! Logical Not
&& Logical And
|| Logical Or
^ Xor
=
!= Not equal
== Equal
+=-=
*=
/=
%=
7/30/2019 Java_Chapter02_Review
10/14
-1-| P a g e
:LoopsFor Loop
As Counter :
.counter.start
.Condition
.Update
.ForBody{ }
Example :
// infinite loop
7/30/2019 Java_Chapter02_Review
11/14
--| P a g e
While Loop:
Code to repeattrue
. while Loop
"
"while
..
Boolean Expr.Condition
.Body
{
}
Example :
7/30/2019 Java_Chapter02_Review
12/14
-2-| P a g e
Do While Loop
: .
true. falsewhile Loop
Condition.
Example :
7/30/2019 Java_Chapter02_Review
13/14
-3-| P a g e
Nested LoopExample :
::
7/30/2019 Java_Chapter02_Review
14/14
-4-| P a g e
Contents
FanniaBackbone Java Course:.................................................--
........................................................................--
Java:
Data Types:
........................................--
:Constatns:.................................................................................................................--
:Variables:...............................................................................................................-2-
:Output Methods.................................................-6-
:......................................................................................................................-7-
:Comments............................................................................................................-7-
:Input Methods..............................................-8-
:...................................-9-:Loops.......................................................................................-1-
For Loop.............................................................................-1-
While Loop:....................................................................--
Do While Loop...........................................................-2-
Nested Loop..................................................................-3-
Contents-4-
http://fanniabackbone.wikispaces.com/