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

Exception Handling


Different List of Exception

java.awt Exceptions
The AWT classes have members that throw one error and two exceptions:
• AWTException (exception in AWT)
• llegalComponentStateException (a component is not in the proper state for a requested    operation)
• AWTErr (error in AWT)
 
 
java.awt.datatransfer Exception
Classes of the AWT data transfer package may throw this exception:
• UnsupportedFlavorException (data in improper format)
 
 
java.beans Exceptions
The classes of the java.beans package throw the following exceptions:
• IntrospectionException (unable to resolve object during introspection)
• PropertyVetoException (illegal property change)
 
 
java.io Exceptions
The classes in the java.io package throw a variety of exceptions, Any classes that work with I/O are good candidates to throw recoverable exceptions. For example, activities such as opening files or writing to files are likely to fail from time to time. The classes of the java.io package do not throw errors at all.
 
 
The java.io exceptions.
 

              

 
 

              

                                                 The java.io exception hierarchy.
 
 
java.lang Exceptions
The java.lang package contains much of the core Java language. The exceptions subclassed from RuntimeException do not have to be declared in a method's throws clause. These exceptions are considered normal because nearly any method can throw them.
 
 
The java.lang exceptions.
 

              

 
 
The java.lang errors.
 

              

 

              

                                                 The java.lang exception hierarchy.
 
 
java.lang.reflect Exception
The classes of java.lang.reflect throw the following exception:
• InvocationTargetException (invoked method has thrown an exception)
 
 
java.net Exceptions
The java.net package handles network communications. Its classes most often throw exceptions to indicate connect failures and the like.
 
 
The java.net exceptions.
 

             

 

              

                                                 The java.net exception hierarchy.
 
 
java.rmi Error
The Java Remote Method Invocation classes allow Java objects to exist on remote machines. These classes throw the following error:
• ServerError (remote server indicates error)
 
 
java.rmi Exceptions
Java objects whose methods are invoked remotely through RMI may throw exceptions.
 
 
The java.rmi exceptions.
 

              

 

              

                                                 The java.rmi exception hierarchy.
 
 
java.rmi.server Exceptions
RMI servers throw exceptions.
 
 
The java.rmi.server exceptions.
 

               

 
 
java.security Exceptions
The Java security API allows users to implement security features in Java. The API includes support for digital signatures, data encryption, key management, and access control.
 
 
The java.security exceptions.
 

              

 

              

                                                 The java.security exception hierarchy.
 
 
java.security.acl Exceptions
The Java security access control list API allows Java developers to control access to specific users. The classes of java.security.acl throw the following exceptions:
• ACLNotFoundException (unable to find access control list)
• LastOwnerExcepti (attempt to delete last owner of ACL)
• NotOwnerExcepti (only the owner may modify)
 
 
java.sql Exceptions
The Java SQL API throws the following exceptions:
• DataTruncation (unexpected data truncation)
• SQLException (SQL error--contains detailed SQL information)
• SQLWarning (SQL warning)
 
 
java.text Exception
The Java text API throws the following exception:
• FormatException (format or parsing error)
 
 
java.util Exceptions
The classes of the java.util package throw the following exceptions:
• EmptyStackException (no objects on stack)
• MissingResourceException (resource missing)
• NoSuchElementException (no more objects in collection)
• TooManyListenersException (thrown by unicast event listeners)
 
NOTE:
Unicast is Java terminology for a singleton server object. Singletons are objects that can be instantiated only once.
 
 
java.utils.zip Exceptions
The Java utilities zip API throws the following exceptions:
• DataFormatException (format error)
• ZipException (Zip error)