JAVA PROGRAM
Object oriented and cant write procedural programs
Functions are called methods
Unit of a program is the class from which objects are created
Automatic garbage collection
Singleinheritance only
Each class contains data and methods which are used to manipulate the data
Programs are small and portable
Multithreaded which allows several operations to be executed concurrently
A rich set of classes and methods are available in java class libraries
Platform Independent
Case sensitive
java program development
* Edit –use any editor
* Compile –use command ‘javac’ if your program compiles correctly, will create a file with extension .class
* Execute –use the command ‘java’
java language keyword
Keywords are special reserved words in java that you cannot use as identifiers for classes, methods or variables. They have meaning to the compiler, it uses them to understand what your source code is trying to do.
first Java program
class FirstPro {
public static void main(String args[])
{
System.out.println("Hello World!“);
}
}
java source files
All java source files must end with the extension ‘.java’
Generally contain at most one top level public class definition
If a public class is present, the class name should match the file name
top level elevents appears in a file
If these are present then they must appear in the following order.
Package declarations
Import statements
Class definitions
identifiers
An identifier is a word used by a programmer to name a variable, method class or label.
Keywords may not be used as an identifier
Must begin with a letter, a dollar sign($) or an underscore( _ ).
Subsequent character may be letters, digits, _ or $.
Cannot include white spaces.
declering