java(10)接口抽象类
package a; public interface aaa { public int getMax(); String getMes(); } package a; import static java.lang.System.out; public class test implements aaa { public int getMax() { int i = 123; return i; } public String getMes() { String s ="实现接口里的方法"; return s; } public static void main(String[] args) { // TODO Auto-generated method stub test t = new test(); int i = t.getMax(); String s = t.getMes(); out.println(i); out.println(s); } }
抽象类的抽象方法必须被继承,抽象类里可以有普通方法,抽象类不能被实例化
instanceof
if( a instanceof B)
{ }