120 likes | 212 Views
Test Review. Week 6. Java Properties. Platform independence Three important properties in object-oriented language Encapsulation Inheritance Polymorphism. Variables. Declaration Definition Valid identifier e num type Assign values o rdinal(). Escape character. ’ ” \ <br> t.
E N D
Test Review Week 6
Java Properties • Platform independence • Three important properties in object-oriented language • Encapsulation • Inheritance • Polymorphism
Variables • Declaration • Definition • Valid identifier • enum type • Assign values • ordinal()
Escape character • \’ • \” • \\ • \n • \t
Format output • System.out.printf(the first part, the second part); • Copy everything except the format specifiers in the firstparameterout to the output (processescape sequences). • The number of format specifiersinthe first parameter MUST be equal to the number of variables/values you wanttooutput in the secondparameter.
Remainder % • Negative case • -17%-5 = -2 • Increment and Decrement • ++x; x++; • Y--; --Y;
Operators • Arithmetic operators • Assignment operators • Relational operators • Logic operators • Short circuited version • Conditional operator • Operator precedence
Type cast • Implicit cast • int double • Explicit cast • double x = 3.0; • int y = (int)x;
Blocks • If • If…else • If…else if…else if…else • while • do…while • for • switch
Nested loop • break • continue
Enum and loop • Iterate all values using values() method • enum in switch statement • Infinite loop
Exceptions using try…catch • Member variables • Local variables • Method call • Public method • Private method • Static method • Named constant • final