REGISTER FREE to Receive Instant Job

Friday, 7 November 2014

Interface in Java

Interface : - An interface is a collection of implicit abstract methods and static final data members. Interfaces are used to abstract the interface of the classes from their implementation.
Syntax of defining an interface:-
interface Identifier
{
static final dataMembers
implicit abstract methods
}

Or
interface Identifier
{
static final dataMembers
}
Or
interface Identifier
{
implicit abstract methods
}

Example –
interface Printable
{
void print();
}
Interfaces are implemented by classes.

Syntax of implementing an interface:-

class className implements InterfaceName
{
public definition of interface methods
addition members (if any) of the class
}

NOTE: If a class implements an interface then it has to provide public definition of all interface methods otherwise the class is declared as abstract.

1 comment:

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.