01 - Java Review V2

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 01 - Java Review V2 as PDF for free.

More details

  • Words: 202
  • Pages: 14
Java Review ●

DASTRAP Term 2, SY 2009 2010

Variables • Primitive Data types ▫ ▫ ▫ ▫ ▫ ▫ ▫ ▫

byte -128 -> 127 short -32,768 -> -32,767 int -2,147,483,648 -> 2,147,483,647 long -9,223,372,036,854,775,808 -> 9,223,372,036,854,775,807 float single-precision 32-bit IEEE 754 floating point double double-precision 64-bit IEEE 754 floating point boolean true or false char ex. ‘a’

Variables • String – not a primitive data type! But java has special support • String literals are enclosed in “ ” • Can be concatenated

Comments • Single line // • Multiple line /* */ • Javadoc /** */

Unary ! ++ --

Mathematical Operations * / % + -

Relational > < >= <=

Equality == !=

Logical AND, OR && ||

Assignment = += -= *= /= %=

++ equal to +=1 x = 1; x+=3; //x=4 -- equal to -=1 x = 3; x-=1; //x=2 x = 2; x*=4; //x=8 x = 9; x/=3; //x=3 x = 9; x%=2; //1

Loops ● ● ●

for while do-while

Loops for( int i=0; i<5 ; i++) { print(“.”); } Result: .....

Loops int i=0; while(i<5) { print(“.”); i++; } Result: .....

Loops int i=0; do{ print(“.”); i++; } while(i<5); Result: .....

Related Documents

01 - Java Review V2
June 2020 1
Java 01
November 2019 2
Review Materi Java
April 2020 6
01-software V2-2009
December 2019 9