Professional Documents
Culture Documents
14 Interface
14 Interface
syntax:
<data type> <variable name>=<value>;
eg:
int data=10;
String name="Balaji";
• Un-Defined methods
– Method declaration only.(called as
abstract method).
– By default, all method as public abstract.
syntax:
<return type> <method name>(<list of formal parameter>);
eg:
int details();
void file(String fileName);
Example for Interface
eg: Printable.java
interface Printable
{
int MIN=5;
void print();
}
Printable.class
interface Printable
{
public static final int MIN=5;
public abstract void print();
}
variable level in interface
public static final <data type> <variable name>=<value>;
(compile time JVM will add)
Here,
final - value Reusable but value not modified.
static - Memory space create only once.
public - every programmer to access.