Error msg

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/learn-java/projects/droid#
<In what way does your code behave incorrectly? Include ALL error messages.>

Droid.java:1: error: ‘{’ expected
public class Droid(){
^
1 error

```

public class Droid(){
int batteryLevel=100;

public void activate(){
System.out.println(“Acctivated. 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 int checkBatteryLevel(){
return batteryLevel;
}
public void hover(int feet){
if(feet>2){
System.out.println(“Error!”);
}
else{
System.out.println(“Hovering”+feet);
batteryLevel=batteryLevel-20;
System.out.println(“Battery level is:” +batteryLevel+“percent”);
}
}
public static void main(String args){
Droid myDroid=new Droid();
myDroid.activate();
myDroid.chargeBattery(5);
myDroid.checkBatteryLevel();
myDroid.hover(1);
}
}

<do not remove the three backticks above>

I think I've been inserting '{'  correctly. But somehow this error msg appeared.

I'd be glad if somebody tells me the reason. 

Please.

It was just a problem of deleting ‘()’ after ‘Droid’…

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