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
Can some one help me immediately ?
Thanks Murali
Mike Cole
Ranch Hand
Joined: Sep 25, 2006
Posts: 38
posted
0
No, that should work. Maybe the error is before that?
Anyway, you can allways make a new file(without anything else) and try if it works there. If it doesen't work there too, you have another problem...
Maybe you need to tell Eclipse that you want to use Java 5.0 features. Go to Window / Preferences / Java / Compiler and check what "Compiler compliance level" is set to.
- do not use the default package (it is discouraged and might give you troubles later on) - make sure you have javac 1.5 (since you compile with javac and not with java) - if you use an IDE to compile, then make sure it uses 1.5 to compile your project (not just 1.5 to run the IDE) (in Eclipse "Project" -> "Properties" -> "Java Compiler" - you should code to the interface, not the implementation
- have fun :-)
Pascal
Mike Cole
Ranch Hand
Joined: Sep 25, 2006
Posts: 38
posted
0
you should code to the interface, not the implementation
Can you explain why?? Ive never heard of that.
pascal betz
Ranch Hand
Joined: Jun 19, 2001
Posts: 547
posted
0
Can you explain why??
maybe i translated this wrong ?...
What i wanted to say...:as long as you do not require a specific implementation (e.g. if you do a lot of List operations and you found that List implementation Foo is considerably faster than implementation Bar) you should use the most generic type possible (and this would be List or even Collection if you do not care about order).
Like this you can change the implementation without changing the interfaces/you do not tie your code to a specific implementation.
Pascal
Mike Cole
Ranch Hand
Joined: Sep 25, 2006
Posts: 38
posted
0
Ahh cool, i didnt think about that. Thanks for the explanation! Damn now i have to change all my code
pascal betz
Ranch Hand
Joined: Jun 19, 2001
Posts: 547
posted
0
Damn now i have to change all my code :-)
Yes. Do it right now. Or your code will stop to work in 5 minutes :-)