Interface
Interface - lerde body-siz metodlar by default public abstract olur.
package main.example9;
public interface Worker {
public abstract void work();
}
Interface - lerde variable-lar public static final olur.
public static final String name = "Parvin";Interface - lerde body-li metodlar yazmaq mumkundur. By default public olurlar.package main;
public interface Runnable {
public static final String name = "Parvin";
public abstract void foo();
public default void foo2() {
System.out.println("foo2 in Runnable");
}
}
Комментарии
Отправить комментарий