I am making a program in which the program assigns a variable to the numbers 1 - 10. I am suppose to use wait and notify. I put them in but I don't know how to assign the variables to the numbers. My code is and could someone tell me how would I assign the vairables
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package vairables;
public class Vairables {
public static void main(String[] args)
{
class IntegerHolder
{
String variable = null;
synchronized void insert(String v)
{
while (variable != null)
{
notify();
wait();
}
variable = v;
notify();
}
synchronized int extract()
{
while ( variable == null)
{
notify();
wait();
}
String temp = variable;
variable = null;
notify();
return temp;
}
}
}
}