日期:2014-05-20 浏览次数:21036 次
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package study;
/**
*
* @author Administrator
*/
public class Interfa {
static void r(CanRead cr){
cr.readMagazine();
cr.readPaper();
}
static void l(CanListen cl){
cl.listenBook();
cl.listhenRadio();
}
static void f(CanFeel cf){
cf.feelCold();
cf.feelWarm();
}
static void al(CanAll ca){
ca.feelCold();
ca.feelWarm();
ca.readMagazine();
ca.readPaper();
ca.listenBook();
ca.listhenRadio();
}
public static void main(String[] args){
Animal an=new Animal();
r(an);
f(an);
l(an);
al(an);
}
}
interface CanRead{
void readPaper();
void readMagazine();
}
interface CanListen{
void listhenRadio();
void listenBook();
}
interface CanFeel{
void feelWarm();
void feelCold();
}
interface CanAll extends CanRead,CanListen,CanFeel{
void all();
}
class Animal extends Ashow implements CanAll{
@Override
public void all() {
System.out.println("all()");
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void readPaper() {
System.out.println("readPaper()");
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void readMagazine() {
System.out.println("readMagazine()");
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void listhenRadio() {
System.out.println("listenRadio()");
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void listenBook() {
System.out.println("listenBook()");
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void feelWarm() {
System.out.println("feelWarm()");
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void feelCold() {
System.out.println("feelCold()");
throw new UnsupportedOperationException("Not supported yet.");
}
}
class Ashow{
void show(){
System.out.println("hello Ashow");
}
}