Chapter 3 - Controlling Execution
true and false All conditional statements use truth or falsehood of a conditional expression to determine the execution path.
Number can’t be used as boolean, alternative way: if (a!=0)
if-else Two forms of using if:
if(Boolean-expression) statement or
if(Boolean-express) statement else statement Iteration Iteration statements (looping):
while while(Boolean-expression) statement do-while do statement while(Boolean-expression) for for(initialization; Boolean-expression; step) statement The comma operator Using the comma operator, you can define multiple variables within a for statement, but they must be of the same type.
Chapter 2 - Everything Is an Object
The Java language assumes that you want to do only object-oriented programming, so (almost) everything in Java is an object.
You manipulate objects with references You treat everything as an object, using a single consistent syntax. Although you treat everything as an object, the identifier you manipulate is actually a “reference” to an object.
String s; You must create all the objects When you create a reference, you want to connect it with a new object.
Chapter 1 - Introduction to Objects
The progress of abstraction Five basic characteristics of object-oriented programming:
Everything is an object.
A program is a bunch of objects telling each other what to do by sending messages.
Each object has its own memory made up of other objects.
Every object has a type
All objects of a particular type can receive the same messages.
An object has an interface The interface determines what request you can make for a particular object.