Java Error: illegal start of expression

前端 未结 4 1155
长发绾君心
长发绾君心 2020-11-30 05:52

I\'m basically refining, completing and trying to compile a test code from a reference book for java beginners. The objective is to create a guessing game wherein the target

4条回答
  •  盖世英雄少女心
    2020-11-30 06:28

    Remove the public keyword from int[] locations={1,2,3};. An access modifier isn't allowed inside a method, as its accessbility is defined by its method scope.

    If your goal is to use this reference in many a method, you might want to move the declaration outside the method.

提交回复
热议问题