如下代码是否能被编译通过?
private class Firework {
private double weight = 0;
private boolean compare(Firework work) {
return weight == work.weight;
}
解释:
代码编译没有问题,访问权限被定义再类级别,而非对象级别。