You are on page 1of 16

A data type is a classification of a particular type of information that is built in feature in Java.

Type
Boolean Byte Char Double Float Int Long Short Stores data in only of two states, as logical value of true or false Stores whole number values in 8 bit signed locations from -128 to + 127 Stores any one of the 65, 436 single characters Stores numbers with up to 14 to 15 decimal places or double precision, floating point values. Store numbers with up to 6 or 7 decimals as floating point values Stores whole number values in 32 bit Stores whole number values in 64 bit Stores whole number values in 16 bit

A variable is an item data used to store state of objects. A variable has a data type and a name. The data indicates the type of value that the variable can hold. <data type> <name> [=initial value];

An identifier is a word that the programmers chooses to label a storage address in memory. A constant is a value that does not change during the course of the program.

pi

LEGAL
firstName first_Name employee7 $amount totalSales invNo123

ILLEGAL
First Name 7employee $amnt.cents Sales& ax 7123

Explanation

numberOfPeo ple

public

OPERATOR
+ * / /

DESCRIPTION
Addition Subtraction Multiplication Division Division with floating point numbers Modular Division

EXAMPLE
20+3 20-3 20*3 20/3 20.0/3.0

RESULT
23 17 60 6 6.6666667

20 % 3

OPERATOR
< > <= >=

DESCRIPTION
Less than Greater than Less than or equal to Greater than or equal to

TRUE EXPRESSION
(2<9) (5>1) (3<=4) (8>=6)

FALSE EXPRESSION
(9<2) (1>5) (5<=4) (3>=7)

==
!=

Equal to
Not equal to

(9==9)
(4!=2)

(5==9)
(2!=2)

Operator
++

Use
op++ Increments op by 1; evaluates to the value of op before it was incremented Increments op by 1; evaluates to the value of op after it was incremented Decrements op by 1; evaluates to the value of op before it was decremented Decrements op by 1; evaluates to the value of op after it was incremented

++

++op

--

op--

--

--op

Create a program that outputs the average of three numbers. Let the values of the three numbers be 10,20,and 45. The expected output is,
Number1 = 10; Number2 = 20;

Number3 = 45;
Average is = 25;

Interactive is the term used with programs that allows the user to interact with program by making choices, entering data, and viewing results.

CLASS
System.in

Function
Accepts data from the keyboard buffer wrapped in the InputStreamReader Send output to the display or redirects to a designed file Sends output to the monitor, used for prompts and errors message readLine() Keyboard Buffer

System.out

Monitor

System.err

Monitor

Package Name
Java.applet Java.awt Java.io java.util

Description
Classes to facilitate using applets Abstract Window Toolkit, classes to facilitates graphics user interface. Classes to facilitate input and output Classes used for dates, vectors and others

Create a program that will accept three unique numbers and display the sum of three numbers.

You might also like