java第四周作业
题目:
根据下列要求定义接口和类:接口canSwim具有一个方法void swim(),接口canJump具有一个方法void jump(),类Frog实现接口canJump和canSwim,实现方法时只需要做输出打印即可。
package cn.test4; interface canSwim{ public void swim(); } interface canJump{ public void jump(); } class Flog implements canJump,canSwim{ @Override public void swim() { System.out.println("swim"); } @Override public void jump() { System.out.println("jump"); } } public class test { public static void main(String[] args) { Flog flog = new Flog(); flog.swim(); flog.jump(); } }