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

Java REPL - Cannot Find Symbol - Interface Evaluation???

I'm having a problem with the REPL.

I have my PezDispenser.java here:

public class PezDispenser{

   //DECLARING VARIABLES: Static means that the int is accesible from class level. No need to initiate.
   public static final int MAX_PEZ = 12;
   private String mCharacterName;
   private int mPezCount;

   //CONSTRUCTOR: Method that is Executed right when file is initiated.
   public PezDispenser(String characterName) {
      mCharacterName = characterName;
      mPezCount = 0;
   }

   //BOOLEAN that is checking if mPezCount is equal to 0, in other words, empty.
   public boolean isEmpty(){
      return mPezCount == 0;
   }

   //LOADER: Loads the Pez Dispenser, void means that the method does not return anything.
   public void load(){
      mPezCount = MAX_PEZ;
   }

   //GETTER: Gets Character Name from private string mCharacterName.
   public String getCharacterName() {
      return mCharacterName;
   }
}

So I go to the java REPL and i do :load PezDispenser.java and everything seems to be fine. But, when I go to declare the class (PezDispenser pd = PezDispenser("Blank");) it gives me an error that reads:

ERROR: cannot find symbol
symbol: class PezDispenser
location: interface Evaluation
PezDispenser method$hw3k46cflis2q7u0ea1b(); ^

If anyone could explain to me what this means It would help alot. Thanks!

2 Answers

This is the bug of REPL.

Chris Ramacciotti has submitted the bug on REPL GitHub repo, check that out for more:

https://github.com/albertlatacz/java-repl/issues/100

In order to fix your program, remove comment with the "class" word in it

public class PezDispenser{

    // comment with removed word
   //DECLARING VARIABLES: Static means that the int is accesible from ... level. No need to initiate.
   public static final int MAX_PEZ = 12;
   private String mCharacterName;
   private int mPezCount;
}

Thanks For The Help! The REPL is up and working now!