It is showed that I have one error in the line 21. Therefore, I need help


#1



class Droid{
  int batteryLevel = 100;
  public Droid() {
  }
  public void activate(){
    System.out.println("Activated. How can I help you?");
    batteryLevel = batteryLevel - 5;
    System.out.println("Battery level is: " + batteryLevel + " percent.");
  }
  public void chargeBattery(){
    int hours;
    System.out.println("Droid charging...");
    batteryLevel = batteryLevel + hours;
    if (batteryLevel >= 100){
      batteryLevel = 100;
      System.out.println("Battery level is: " + batteryLevel + " percent.");
    } else {
      System.out.println("Battery level is: " + batteryLevel + " percent.");
    }
   }
   public checkBatteryLevel(int batteryLevel){
     System.out.println("Battery level is: " + batteryLevel + " percent.");
     return batteryLevel;
  }
}


#2

You have to specify return type (the data type of the value returned by the method) for the checkBatteryLevel method.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.