Java.. Your Own Droid


#1

Hey if someone can please help, I cant figure out exactly what I'm doing wrong.

Errors

Droid.java:47: error: illegal start of expression
public static void main(String[] args){
^
Droid.java:47: error: illegal start of expression
public static void main(String[] args){
^
Droid.java:47: error: ';' expected
public static void main(String[] args){
^
Droid.java:47: error: '.class' expected
public static void main(String[] args){
^
Droid.java:47: error: ';' expected
public static void main(String[] args){
^
5 errors


#2

Hi @ksemaidi, all I can see is you forgot to add a closing
bracket on line 42. Try adding that and letting me know if
it fixed the problem, thanks!


#3

in addition to what @kodeman89

it is a good practice to give the class a modifier (public , private, protected) like this

  public class Droid{

it will be a good idea to set the fields of the class to be private

  private int batteryLevel;

it s principle called Encapsulation


#4

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