问答详情
源自:7-8 Java 中的方法内部类

mutiple markers at this line

public class HelloWorld2 {

    public class Inner {

        public void show ( ) {

            System.out.println ( "imooc" ) ;

        }
    
    }
    
    public static void main ( String [ ] args ) {

   
        public void print ( ) {  //这行提示mutiple markers at this line 哪里有问题啊

           HelloWorld2 hello = new HelloWorld2 ( ) ;

           Inner i = hello.new Inner ( ) ;

          i.show ( ) ;

        }
                
    }

}

提问者:zdn2100 2017-01-30 17:22

个回答

  • 吱吱叫的老鼠
    2017-02-27 20:54:51
    已采纳

    出错的那一行要删掉去,函数内部不能再写函数,main也是函数,所以会报错。删掉这一行和下面的一个右括号就可以运行了

  • qq_fighting遥_0
    2017-01-30 17:35:29

    print是JAVA关键字,不能做方法名