class SomeClass {
Graphic_handler grap;
public static void main(String[] args) {
Graphic_handler grap = new Graphic_handler(bot);
^^^^ this *hides* the other grap
grap.start();
}
}
为了解决此问题,只需在方法中删除grap前面的声明即可。
class SomeClass {
Graphic_handler grap;
public static void main(String[] args) {
grap = new Graphic_handler(bot);
grap.start();
}
}
What's going on is you have a local variable that is hiding the instance variable.
class SomeClass {
Graphic_handler grap;
public static void main(String[] args) {
Graphic_handler grap = new Graphic_handler(bot);
^^^^ this *hides* the other grap
grap.start();
}
}
To fix this just remove the declaration in front of grap in the method.
class SomeClass {
Graphic_handler grap;
public static void main(String[] args) {
grap = new Graphic_handler(bot);
grap.start();
}
}
发布评论
评论(1)
发生的事情是您有一个隐藏实例变量的局部变量。
为了解决此问题,只需在方法中删除
grap
前面的声明即可。What's going on is you have a local variable that is hiding the instance variable.
To fix this just remove the declaration in front of
grap
in the method.