• Post Reply Bookmark Topic Watch Topic
  • New Topic

Parameterising in ArrayList throws error  RSS feed

 
seshayya krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to parameterisze the arraylist as follows. I am getting compilation error.

1. About my environment I had installed java 1.5 and JRE . I had checked the java version it shows 1.5

2. In my Eclipse build path, I had added all necessary jar file.

But still the following throws Compilation error .

private ArrayList<Item> myStore = new ArrayList<Item>();

Can some one help me immediately ?

Thanks
Murali
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the exact error that you get?

Did you import java.util?

Also is Item in scope?
[ November 12, 2006: Message edited by: Keith Lynn ]
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly does the compiler complain about. What is the text of the error message?
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also do have this line inside a method?
 
seshayya krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Item is a class which contains getter and setters. Further it is in the same default package (located in the same work space).

1. I am importin java.util.* package.

I am getting the following error messages.

Multiple markers at this line
Syntax error on token "<" , ( expected
Syntax error on token "(" invalid expression
Syntax error on tokens delete these tokens
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't post the same question twice.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the eclipse settings

project right click on your project in the package explorer

select properties

select java compiler, hook "project specific" yes
compiler compliance level 5.0

Ok button.


OK?

Yours,
Bu
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!