
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Introducing Programming with
an Example
ComputeArea Run
//Compute the first area
radius = 1.0;
area = radiusradius3.14159;
System.out.println("The area is "+area+" for radius "+radius);
//Compute the second area
radius = 2.0;
area = radiusradius3.14;
System.out.println("The area is "+area+" for radius "+radius);
int x; // declares x to be an
// integer variable;
double radius; // declares radius to
// be a double variable;
char a; // declares a to be a
// character variable;
Format:
static final datatype CONSTANT = VALUE;
Example:
static final double PI = 3.14159; static final int SIZE = 3;
or
or
Operator Example Equivalent
Consider the following statements:
byte i = 100;
long l = i*3+4;
double f = i*3.1+l/2;
Character Escape Sequence ASCII Unicode
Backspace \b \u
Tab \t \u
Linefeed \n \u000a
Carriage return \r \u000d