Core Java

Java Evolution
Java History
Java Features
Benefits of Java over C and C++
How Java works
The Java Programming Language
The Java Platform
Java Development Kit
HARDWARE AND SOFTWARE REQUIREMENTS
Disadvantages of Java
Overview of Java Language
Developing the Java Application
Comments in Java Code
Defining a Class
The main Method
Using Classes and Objects
Java Program Structure
Java Tokens
Constant, Variable and Datatype
Variables
Declaring Variables
Rules on Variable Names
Variable Types
Primitive Data Types
Constants
Operator and Expression
Expressions and Operators
Operator Precedence
Integer Operators
Relational Integer Operators
Floating point Operators
Relational Floating-Point Operators
String Operator
Assignment Operators
Arithmetic assignment operations
Conversions
Casts
Boolean expressions and operations
Logical operators
Bitwise operations
The complement operator
Decision making, Branching and Looping
Flow control with if and else
The if statement
The else statement
Switch statements
for, while, and do-while statements
The for statement
The while statement
The do-while statement
Using break and continue
The break statement
The continue statement
Class Object and Method
Introduction to Classes
The Benefit of Classes
Defining Classes
Class using constructor
Object
Declaring an Object
Instantiating an Object
Initializing an Object
Referencing an Object's Variables
Calling an Object's Methods
Creating a Class
The Class Declaration
The Class Body
Constructors for Classes
Implementing Methods
The Method Body
A Method's Name
Example of the Math class
The Applet Package
Array and String
Arrays
Java arrays
Object arrays
Strings
String Concatenation
Inheritance
Introduction
Creating Subclasses
Member Variables In Subclass Inherit?
Hiding Member Variables
Methods In Subclass Inherit?
Overriding Methods
Methods a Subclass Cannot Override
Methods a Subclass Must Override
The Benefits of Inheritance
Interfaces
Interfaces and Classes
Implementing and Using Interfaces
Implementing Multiple Interfaces
Creating and Extending Interfaces
Methods Inside Interfaces
Extending Interfaces
Package
Introduction
Declaring Packages
Importing Packages
Creating Our Own Packages
The Java Language Package
The Java I/O Package
The Java Utility Package
The Java Networking Package
The Applet Package
The Abstract Window Toolkit Packages
Multithreading
Introduction
Thread
Thread Attributes
Thread State
Thread Group
Methods that Operate on the Group
Access Restriction Methods
The notifyAll() and wait() Methods
Frequently used Method
Exception Handling
Introduction
What Is an Exception?
If Exceptions than?
The exception handling technique
Some Terminology
Throw an Exception
Throw, try, and catch Blocks
Multiple catch Blocks
The finally Clause
The Throwable Class
Types of Exceptions
Different List of Exception
Built-In Exceptions
Applet
Introduction
How Applets and Applications Are Different
Limitation of Applet
The Applet class
Major Applet Activities
The life cycle of a Web page applet
Including an Applet on a Web Page
Essential HTML to launch an applet and pass it parameters
Launching an applet in an HTML document
A sample applet that receives a parameter
Posting a Web page that launches a custom applet
Managing Input/Output Files in Java
Introduction
Streams
Input Streams
The Abstract Class InputStream
The File class
The FileDialog class
Low-level and high-level stream classes
The FileOutputStream class
The FileInputStream class
The DataOutputStream class
The DataInputStream class
The ObjectOutputStream class
The ObjectInputStream class

Overview of Java Language


Java Tokens

The smallest individual units in a program are known as TOKEN.
A java program is a collection of tokens, comments and white spaces.
Java language includes five types of tokens
 
They are:
 
1) Reserved Keyword
2) Identifiders
3) Literals
4) Operator
5) Separators
 
 
Reserved Keyword
Keywords have specific meaning and implement specific features of the language.
Java language has reserved 60 words as keywords.
 
 
Identifiers
Identifiers are programmer-designed tokens. They are used for naming class,
methods, variables, objects, labels, packages, and interface in a program.
 
 
Literals
Literal is a programming language term that essentially means that what you type is what you get. Numbers, characters, and strings are all examples of literals.
 
Therefore literals
1) Are constants having no identifier?
2) Have their value specified within the program's source code?
3) Can only appear on the right side of an assignment operator (=) or within an      expression?
4) Have a data type associated with them?
 
 
Java program has five major types of literals:
1) Integer Literals
2) Floating type literals
3) Character literals
4) String literals
5) Boolean Literals
 
 
Integer literals
1. Represent an integer value
2. Can be expressed in decimal (the default), octal (base 8, or hexadecimal (base 16)
3. Are not enclosed in any special characters
4. Are automatically int (32 bits) unless the suffix 'L' is appended to make it long (64 bits)
 
 
Floating-point literals
1. Represent a real number (having a decimal point)
2. Can be expressed as a standard decimal value or in scientific notation
3. Are not enclosed in any special characters
4. Are automatically double (64 bits) unless the suffix 'F' is appended to make it float (32     bits)
 
 
char literals
1. Represent a single Unicode character (16 bits)
2. Must be enclosed within single quotes (apostrophes)
3. Are often associated with a single key stroke
4. Can represent special characters ("escape sequences") used for device control
 
 
String literals
1. Represent a string of characters, such as "Java is fun"
2. Must be enclosed in double quotes
3. Are automatically stored as String class objects by the compiler. They will be covered     later.
 
 
boolean literals
1. Can only have the value true or false
2. Can only be assigned to boolean variables
 
 
Constants
1. Are similar to variables but, once initialized, their contents may NOT be changed?
2. Are declared with the keyword final?
3. By convention, have all capital letters in their identifier. This makes them easier to see within the code.
 
 
Operators
An operator is a symbols that takes one or more arguments and operates on them to produce a result.
 
 
Separators
Separators are symbols used to indicate where groups of code are divided and arranged. They are basically define the shape and function of our code.
Ex: {}, [], ; , . , () etc.