Hi experts,

I have a question on generating a hashtable which contains only unique numbers. Can anyone help me out. My code is here.
I want to check if the key and value are in the hashtable or not. if they are in the hashtable i break to start generate a random row and column and then check whether the pair is in the hashtable or not. I could not figure out how to do. Also i get an error when breaking to the label start. the compiler says undeclared START. Can anyone help me please. I need it urgent.

while(counter != random_Value){
            randomRow = random_element.nextInt(9);
            randomColumn = random_element.nextInt(9);
                mapRowCol.put(randomRow, randomColumn);
                System.out.println("Row, Col: " +mapRowCol.entrySet());
               // break START;
            System.out.println("Counter: "+counter);

Thank you very much. Little help is appreciated !

I don't really know how to elaborate on the compiler's error message. It literally says exactly what the problem is: you're using a variable "START" which was never declared, which is illegal. Either declare it or get rid of it. It looks useless to me; so delete it. And where you have break START; it should say "break;"

BREAK appears to be a valid label
and the break with a label also seems valid
I just ran them thru Eclipse (Java 1.6u20) and they generated no errors, although the label does seem completely redundant in this case.

What exactly was the error message and exactly which line did it refer to?

Edited 6 Years Ago by JamesCherrill: n/a

This article has been dead for over six months. Start a new discussion instead.