11智能在线
新记
java中静态方法中不能调用非静态方法
如题所述
举报该文章
其他看法
第1个回答 2019-03-30
静态static方法中不能调用非静态non-static方法是值得是不能直接调用non-static方法
public
class
Test01
{
public
static
void
main(String[]
args)
{
hello();
}
public
void
hello()
{
}
}
是指的这种
在静态的main方法中,直接调用了本类的非静态方法hello(),这种是不允许的
相似回答
大家正在搜
相关问题
java中静态方法中不能调用非静态方法
JAVA中"静态方法中不能直接调用非静态的属性和方法"何以理...
java中如何在静态方法中实现对非静态方法的调用,请问各位有...
Java中静态方法与非静态方法的区别?
java 静态方法里面可以调用非静态方法吗
java中为什么静态方法不能访问非静态方法或者变量
非静态方法中不能直接调用静态方法吗
java中静态方法能否访问非静态成员