Java, non-static cannot be reference to static context

后端 未结 2 925
旧时难觅i
旧时难觅i 2021-01-26 10:19

Doing Java course, at UNI atm, and I\'m having a bit of trouble with a dice-problem.

I have the following:

 public class Die {
   public int eyes;
   pri         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-26 11:14

    Remove

    Die.n
    

    and change it to simply

    n
    

    If n were declared static, you could use the both notations, even though the first one would be redundant (because you're from the inside of containing class)

提交回复
热议问题