Java Reference
In-Depth Information
Programs, Data, Variables, and
Calculation
In this chapter we will look at the entities in Java that are not objects - numbers and characters. This
will give you all the elements of the language you need to perform numerical calculations, and we will
apply these in a few working examples.
By the end of this chapter you will have learnt:
How to declare and define variables of the basic integer and floating point types
❑
How to write an assignment statement
❑
How integer and floating point expressions are evaluated
❑
How to output data from a console program
❑
How mixed integer and floating point expressions are evaluated
❑
What casting is and when you must use it
❑
What
boolean
variables are
❑
What determines the sequence in which operators in an expression are executed
❑
How to include comments in your programs
❑