abstract static class Ai
{
boolean a;//布耳值判断是否是哺乳类动物
boolean b;//判断是否是食肉动物
static final int qingxu=1;
static final int huaiqingxu=2;
public boolean vc()//判断是否返回true或false
{
return(a);
}
public boolean vv()//判断是否返回true或false
{
return(b);
}
abstract void op();//抽象方法
abstract void opl(int mood);//抽象方法
}
public interface gettui//接口
{
public void aa(int tui);
}
public interface shui//接口
{
public void bb();
}
class Cat extends Ai implements gettui,shui//子类继承父类调用接口
{
private int tui=4;
Cat()
{
a=true; //继承后调用父类里的A返回给父类
b=false;//继承后调用父类里的B返回给父类
}
public int aa()
{
return(tui);
}
public String bb()
{
return("猫不会下水");
}
switch(mood)
{
case:qingxu
return("好心情的时候喵喵");
case:huaiqingxu
return("好心情的时候咬人");
}
void op()
{
System.out.println ("猫平时在睡觉");
}
public static void main(String[] args)
{
Cat cat=new Cat();
String str1,str2;
If(cat.vc()) str1="是" else str1="不是";
If(cat.vv()) str2="是" else str2="不是";
System.out.println("猫"+str1+"哺乳动物,"+str2+"肉食类动物\n"+"它有"+cat.aa()+"条腿,"+cat.bb()+cat.opl(Ai.qingxu)+"\n");
}
}
{
boolean a;//布耳值判断是否是哺乳类动物
boolean b;//判断是否是食肉动物
static final int qingxu=1;
static final int huaiqingxu=2;
public boolean vc()//判断是否返回true或false
{
return(a);
}
public boolean vv()//判断是否返回true或false
{
return(b);
}
abstract void op();//抽象方法
abstract void opl(int mood);//抽象方法
}
public interface gettui//接口
{
public void aa(int tui);
}
public interface shui//接口
{
public void bb();
}
class Cat extends Ai implements gettui,shui//子类继承父类调用接口
{
private int tui=4;
Cat()
{
a=true; //继承后调用父类里的A返回给父类
b=false;//继承后调用父类里的B返回给父类
}
public int aa()
{
return(tui);
}
public String bb()
{
return("猫不会下水");
}
switch(mood)
{
case:qingxu
return("好心情的时候喵喵");
case:huaiqingxu
return("好心情的时候咬人");
}
void op()
{
System.out.println ("猫平时在睡觉");
}
public static void main(String[] args)
{
Cat cat=new Cat();
String str1,str2;
If(cat.vc()) str1="是" else str1="不是";
If(cat.vv()) str2="是" else str2="不是";
System.out.println("猫"+str1+"哺乳动物,"+str2+"肉食类动物\n"+"它有"+cat.aa()+"条腿,"+cat.bb()+cat.opl(Ai.qingxu)+"\n");
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货