Java: A Puzzle about Constructor…

来源:互联网 发布:php开发扫码支付 编辑:程序博客网 时间:2024/05/21 15:01

package cn.com.sina.blog.chanryma.interf;

public interface IAction {
    voidwalk();
}

package cn.com.sina.blog.chanryma.impl;

import cn.com.sina.blog.chanryma.interf.IAction;

 

public class Human {
   protected classNewBeing implements IAction {
       @Override
       public void walk() {
           System.out.println("Walk and walk...");
       }
    }
}

Java: <wbr>A <wbr>Puzzle <wbr>about <wbr>Constructor <wbr>of <wbr>Inner <wbr>Class

Because of NewBeing is protected,there is an error. To remove it, NewBeing needs tobe public or a public constructorfor NewBeing is required.

 

0 0
原创粉丝点击