Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Mariano Giustozzi
Mariano Giustozzi
3,351 Points

Problems with my workspace JAVA

When I first started with the JAVA Objects course everithing was ok but at some point my workspace started to show me more than 5 erros, I mean il show you how I've wrote my code and tell what can you see, i've been looking this errors on the web but i cant make it work.

Example.java

public class Example { public static void main(String[] args) {

    // Your amazing code goes here...
    System.out.println("Estamos haciendo un dispenser .");
    PezDispenser dispenser = new PezDispenser ();
  System.out.printf("El dispenser es del personaje is %s\n", dispenser.getCharacterName ());

} }

PezDispenser.java

public class PezDispenser { private String mCharacterName = "Yoda";

public String getCharacterName ();{ return mCharacterName; } }

And this are the errors when i use the "javac Example.java"

public class PezDispenser { private String mCharacterName = "Yoda";

public String getCharacterName ();{ return mCharacterName; } }

Thanks ! =D

1 Answer

Geovanie Alvarez
Geovanie Alvarez
21,500 Points

Segun el codigo veo que hablas espaΓ±ol, el problema que veo es el semilocon despues del metodo por ejemplo en el PezDispenser.java

public class PezDispenser {
    private String mCharacterName = "Yoda";

    public String getCharacterName ();{ // <------ aqui
        return mCharacterName; 
    } 
}

deberia ser asi

public class PezDispenser {
    private String mCharacterName = "Yoda";

    public String getCharacterName () { // <------ sin semicolon
        return mCharacterName; 
    } 
}
Mariano Giustozzi
Mariano Giustozzi
3,351 Points

It works now =) mira lo simple que era jaja muchas gracias Geovanie