(Java中的新手)我在SO上找不到这个问题。我有项目,有两个文件(phseudo码):从其他类像本地方法使用方法?
第一个Java文件(类)
public class A {
public void xyz() { System.out.println("hello");}
}
二Java文件(类)
public class B Extends ZZZZZ {
public void callme() {
xyz(); // <----------------- I want to call in this way, but It cant be done like this.
}
}
如何使xyz()
成功调用(就好像是在b()
课堂里面定义的那样!!)。
p.s.再次,我不想在前面加上类名来称呼它,就像这样:
a.xyz();
*“调用这个显示错误”*什么错误? –
另外:这是你的原始代码这个未知的类'字符串或者是你的shift键不可靠吗? –
'new'不是变量的好名字... – luk2302