Sunday, March 1, 2009

interface method declarations



package interfaces;
interface Imethods
{
int m1(); // By default public abstract int m1()
abstract void m2();
// private void m3(); error
// public static void m4(); error
// public static synchronized m4() error


}
public class Interfacemethods implements Imethods {
public int m1() // with out public we will get error
{
System.out.println("implementation m1");
return 10;
}
public void m2() // with out public we will get error
{
System.out.println("implementation m2");
}
}



0 comments:

Post a Comment