public interface Person { public double calcuMonthlySalary(double sal, int type); } public class Manager implements Person { public Manager () { } public double calcuMonthlySalary(double sal, int type) {
Java中我们一般会使用new关键字实例化对象然后调用该对象所属类提供的方法来实现相应的功能,比如我们现在有个主类叫Web类这个类中能实现各种方法,比如用户注册.发送邮件等功能,代码如下: /* * web功能实现类 */ public class Web { public static void main(String[] args) { //每次有新功能都需要重新加载 if("UserReg".equals(args[0])) { UserReg ur = new UserReg(