Skip to Main Content

Java Programming

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!

Java Error: '(' or '[' expected

AravindhKNov 28 2011 — edited Nov 28 2011
Hi,

When i am trying to compile the Java program in cmd , I am getting following error.
Java Error: '(' or '[' expected
List<String> members = new ArrayList<String>();

I have set Java home and all the jar files in cmd. But i am able to compile the same code without any errors in eclipse. Please can you give your suggestions?

import java.util.List;

public class GetData
{
public void getTest(String c, String sub)
{
List<String> members = new ArrayList<String>();

members.add("test");
}
}

Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 26 2011
Added on Nov 28 2011
9 comments
5,724 views