mohe

java中接口的简单运用&java中的一些异常(运用myeclipse)

别来无恙 提交于 2019-12-10 01:25:26
package test;//创建一个名为test的包 public class A4paper implements Paper { public String getSize(){ return"A4";//实现接口Paper } } package test; public class B5paper implements Paper { public String getSize(){ return"B5";//实现接口Paper } } package test; public class ColorMohe implements Mohe { public String getColor(){ return "colorful";//实现接口Mohe } } package test; public interface Mohe { public String getColor();//创建接口Mohe } package test; public interface Paper { public String getSize();//创建接口Paper } package test; public class Printer { private Mohe mohe; private Paper paper; public void print(){ System