Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

( or [ expected error message

843810Mar 8 2006 — edited Mar 8 2006
I 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???????
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2006
Added on Mar 8 2006
1 comment
188 views