|
Developing a java program
The java development
kit (JDK) provides all features
to write programs. The JDK is available for system
running Windows NT, Windows 95 and Solaris 2.3 or
higher. Java applications are general programs written
in the java language that do not require a browser
to run. J2ee, java servlet are advance of java and
it has jdbc
dirver model.
- The java program file saved as filename. Java
- Compile program by javac filename. Java
- Execute
program by java filename
Features presents in java
Data types
Java provides different data types that include integer,
float, character, Boolean.
- Integers
are used for storing integer values
- Float
is used to store number with decimal part
- Character
is used for storing individual characters
- Boolean
data types hold either a true or a false value
Variables
In variables java has three kinds of variables they are
instance variables, local variables, class variables.
- Instance
variables are used to define attributes or the state of a particular objects.
- Local
variables are used inside blocks as counters or in methods as temporary
variables.
- Class
variables are global to a class and to all the instances of the class.
Declaring variable
Variables can be declared anywhere in the method definition
and can be initialized during their declaration.
Variable names
Variable names in java can start with a letter, an
underscore, dollar sign but it cannot begin with a numbers.
Variable types
Variable types can be any data type that supports the eight
primitive types, the names of class or interface and an array.
Assigning values
Values are assigned to variable using the assignment
operator.
Literals
A literal represents a value of a certain type where the
type describes the behavior of the value, there are different types of literals,
and they are
- Number
- Character
- Boolean
- String
Expressions
Expressions are the simplest form of statements in java.
These statements return a value that can be assigned to a variable.
Operators
Operators are special symbols used in expression; they
include arithmetic operators, assignment operators, incrementing and
decrementing operators, comparison operators, logical operators, bitwise
operators, and operator precedence.
Programming constructs
Programming constructs in java are the If construct,
conditional operator, while loop, do while loop, for loop, switch statement,
break and continue statement.
|