首页 > 代码库 > java的接口与继承和抽象

java的接口与继承和抽象

package ClassInherit;

public interface IBook {
void WriteContent();
}

 

package ClassInherit;

public class AndroidBook extends Book implements IBook {

/* (non-Javadoc)
* @see ClassInherit.IBook#WriteContent()
*/
@Override
public void WriteContent() {
// TODO Auto-generated method stub
System.out.println("WriteAndroid");

}

public AndroidBook(String bookName, String author, int price) throws Exception {
super(bookName, author, price);
// TODO Auto-generated constructor stub
}

public AndroidBook() {
// TODO Auto-generated constructor stub
}

/* (non-Javadoc)
* @see ClassInherit.Book#doSeal()
*/
@Override
void doSeal() {
// TODO Auto-generated method stub
super.doSeal();
}

/* (non-Javadoc)
* @see ClassInherit.Book#getCount()
*/
@Override
public void getCount() {
// TODO Auto-generated method stub
//super.getCount();
System.out.println("安卓电子书");
}

public void SupportAndroid(){
System.out.println("SupportAndroid");
}

}

package ClassInherit;

public abstract class Sealer {

public Sealer() {
// TODO Auto-generated constructor stub
}
abstract void doSeal();

}

java的接口与继承和抽象