( or [ expected error message
843810Mar 8 2006 — edited Mar 8 2006I have constructed a simple class and can't understand why I get an erro message : '( ' or '[' expected error message in the constructor.
This is part of my code:
public static void main(String [] args)throws java.lang.Exception
{
Operator operator = new Operator();
}
public Operator()
{
milkProportion = 30;
chocProportion = 60;
nutProportion = 10;
temp = 50;
ArrayList<String> ingrdnt = new ArrayList<String>(); // this is the line where I am getting the error message
ingrdnt.add("milk");
ingrdnt.add("chocolate");
ingrdnt.add("nut");
ingrdnt.add("temperature");
//create a reader so that the system can retrice what the user has inputted
reader = new BufferedReader(new InputStreamReader(System.in));
randomTime = new Random();
for (int i = 0; i<= 10; i++){
startProcess();
try{
Thread.sleep(randomTime.nextInt(31) * 1000);
}catch (Exception e){}
}
}
Please could someone help me, I have counted the number of parentheses many many times and can't figure out what I have done wrong???????