标签:
http://www.cnblogs.com/liunanjava/p/4296045.html
自己写的例子
package com.sougn.trynew;
public abstract class AbstractTry {
private int id; private String name; public abstract void say(); public void say2() { System.out.print("hello word"); } }
package com.sougn.trynew;
public class AbstractTry2 extends AbstractTry{
public void say() { System.out.print("abstract hello word"); } }
package com.sougn.trynew;
public interface interfacetry {
public void say();
public void sayInterface(); }
package com.sougn.trynew;
public class interfacetry2 implements interfacetry{
public void say() { System.out.print("hello word"); } public void sayInterface() { System.out.print("interfaceTry2"); } }
package com.sougn.trynew;
public interface interfacetry3 extends interfacetry{
public void say3(); }
package com.sougn.trynew;
public class trynew {
public static void main(String[] args) { // TODO Auto-generated method stub AbstractTry2 abstractTry = new AbstractTry2(); abstractTry.say(); abstractTry.say2(); interfacetry2 interfacetry2 = new interfacetry2(); interfacetry2.sayInterface();
}
}
标签:
原文地址:http://www.cnblogs.com/ututuut/p/4374940.html