The program below does not compile. Which statement correctly describes the problem?
class Battery {
private int charge = 50;
public void setCharge(int c) { if (c >= 0 && c <= 100) charge = c; }
public int getCharge() { return charge; }
}
public class Main {
public static void main(String[] args) {
Battery b = new Battery();
b.charge = 150;
System.out.println(b.getCharge());
}
}
The compiler enforces encapsulation.