【发布时间】:2014-09-01 10:18:05
【问题描述】:
作为一个初学者,我想知道为什么我的caller.VelocityC 只在放在主块内时才有效?
当我有这样的代码时,我无法调用该方法。
方法调用类:
public class Velocity2 {
VelocityCounter caller = new VelocityCounter();
caller.VelocityC(6, 3);
}
包含该方法的类:
public class VelocityCounter {
void VelocityC(int s, int v){
System.out.print(s/v);
}
}
【问题讨论】: