Java Error: expected inside protected interface

后端 未结 1 1286
春和景丽
春和景丽 2020-12-12 04:53

I am facing the following problem. I was trying to put together a simple tutorial on the strategy in Java when I ran into a problem. The compiler gives me an \"

1条回答
  •  执笔经年
    2020-12-12 05:11

    The method name do is a Java keyword (Section 3.9, JLS) and can't be a method name. Change your method name to something not a keyword.

    protected static interface Strategy{
        void doAction(int i);
    }
    

    0 讨论(0)
提交回复
热议问题