Nace Solutions (P) Ltd.
Copyright © 2008,All Rights Reserved.
Java Technology
Interfaces and Exceptions
2
Nace Solutions (P) Ltd.
Copyright © 2008,All Rights Reserved.
Session Plan
Interfaces in Java
Packages in Java
Need and Advantages of using package
Creating a Package
Using Existing Packages
Java Class Libraries
3
Nace Solutions (P) Ltd.
Copyright © 2008,All Rights Reserved.
Session Plan
Basic concepts of Exception Handling
Errors and Exceptions
Try – Catch – Finally block
Throw & Throws
Some Built-in exceptions
User defined exceptions
4
Nace Solutions (P) Ltd.
Copyright © 2008,All Rights Reserved.
Interfaces in Java
An interface is a set of predefined methods to be implemented
by one or more classes in future.
Java achieves multiple inheritance. By providing the interface
keyword, Java allows to fully utilize the “one interface, multiple
methods” aspect of polymorphism
Interfaces do not have any instance variables. Any variable
declared in an interface is automatically taken as public, static
and final
5
Nace Solutions (P) Ltd.
Copyright © 2008,All Rights Reserved.
Creating an interface class
public interface myinterface
{
public void method1(int x, int y) ;
}