Java Training Ppts
Java Training Ppts
Inheritance
Bi-Gems Technologies
Inheritance
Bi-Gems Technologies
Bi-Gems Technologies
Method overriding
Bi-Gems Technologies
Abstract Class
superclass that only defines a generalized form that will be shared by all
of its subclasses, leaving it to each subclass to fill in the details. Such a
class determines the nature of the methods that the subclasses must
implement
Bi-Gems Technologies
Bi-Gems Technologies
Exception-Handling
A Java exception is an object that describes an exceptional (that is,
error) condition
that has occurred in a piece of code
When an exceptional condition arises, an object representing that
exception is created and thrown in the method that caused the error.
That method may choose to handle the exception itself, or pass it on
Java exception handling is managed via five keywords: try, catch,
throw, throws, and
Finally
Program statements that you want to monitor for exceptions are
contained within a try block.
If an exception occurs within the try block,it is thrown. Your code
can catch this exception (using catch) and handle it in some rational
manner
Bi-Gems Technologies
Inheritance
Bi-Gems Technologies
Exception types
All exception types are subclasses of the built-in class Throwable
Throwable are two subclasses that partition exceptions into two
distinct branches
One branch is headed by Exception. This class is used for exceptional
conditions that user programs should catch
Exceptions of this type are automatically defined for the programs that
you write and include things such as division by zero and invalid array
indexing.
The other branch is topped by Error, which defines exceptions that
are not expected to
be caught under normal circumstances by your program
Bi-Gems Technologies
Uncaught Exceptions
Bi-Gems Technologies
Multiple try
Bi-Gems Technologies
throws
Bi-Gems Technologies
Predefind exceptions
Bi-Gems Technologies
Inheritance
Bi-Gems Technologies
Multi Threading
multithreaded program contains two or more parts that can run
concurrently. Each part of such a program is called a thread, and each
thread defines a separate path of execution
When a Java program starts up, one thread begins running immediately.
This is usually
called the main thread of your program,
Bi-Gems Technologies
Creating a Thread
In the most general sense, you create a thread by instantiating an object
of type Thread.
Java defines two ways in which this can be accomplished:
You can implement the Runnable interface.
You can extend the Thread class, itself
Bi-Gems Technologies
Bi-Gems Technologies
Bi-Gems Technologies
Interfaces
An interface is a collection of abstract methods. A class implements an interface,
thereby inheriting the abstract methods of the interface
Interfaces are syntactically similar to classes, but they lack instance variables,
and, as a general rule, their methods are declared without any body
interfaces that dont make assumptions about how they are implemented
To implement an interface, a class must provide the complete set of methods
required
by the interface
each class is free to determine the details of its own implementation.
Bi-Gems Technologies
Interfaces
Bi-Gems Technologies
Bi-Gems Technologies
Character Streem
Bi-Gems Technologies
Byte Stream
Bi-Gems Technologies
Bi-Gems Technologies
Bytearray Stream
Bi-Gems Technologies
Bi-Gems Technologies
Bi-Gems Technologies
Number Methods
xxxValue()
Converts the value of this Number object to the xxx data type and
returned it.
method for each primitive data type:
Byte
byteValue()
Short
shortValue()
int intValue()
long
longValue()
Float
floatValue()
double doubleValue()
Bi-Gems Technologies
compareTo()
The method compares the Number object that invoked the method to
the argument. It is possible to compare Byte,Long, Integer, etc.
Bi-Gems Technologies
equals()
The method determines whether the Number Object that invokes the
method is equal to the argument.
Bi-Gems Technologies
toString()
The method is used to get a String object representing the value of the
Number Object
parseInt()
This method is used to get the primitive data type of a certain
String.
Bi-Gems Technologies
Bi-Gems Technologies
Bi-Gems Technologies
Inheritance
Bi-Gems Technologies
Inheritance
Bi-Gems Technologies
Inheritance
Bi-Gems Technologies
Inheritance