Learning objectives

 

In this unit you will learn:

-   the structure of a basic Java program

-   four common numeric data types and their properties

-   how to declare variables of these types and how to construct arithmetic expressions using variables

 

 

 

After trying out some println statements with variations of arithmetic and Boolean expressions (those with relational operators such as !=), we quickly come to a realization that we’re not doing anything fancier than what a 1970’s calculator can do.  What next?  How can we go beyond executing arithmetic expressions with numeric values?  One way that’s very familiar to us, but from a different context, is to be able to represent values symbolically – that is using a variable.  The notion of a variable in programming is the same as in mathematics except that a variables in Java has a designated type.  In this unit you’ll learn about these types, how to declare variables and use them to build expressions.  But first, to move beyond writing single statements, we have to get acquainted with how to construct a complete Java program.