Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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