QUICK Java question!

duragezic

Lifer
Oct 11, 1999
11,234
4
81
I have to do a design for a program...

One of my instance variables is (since we are designing, we are being abstract)

private Set<Planet> planets;


Yet when I compile from the school computers, I got an error saying <indentifier> expected on that line. Yet it works fine from home. And I've done the same exact Set thing so many times... like my last assignment had private Set<Track> tracks; without error. WTF?? I imported java.util.* but that didn't help. Any ideas?
 

duragezic

Lifer
Oct 11, 1999
11,234
4
81
Nope, I'm only importing java.util.* which I may not even need.

Hell, the reason I'm doing that Set is because my prof has a lot of examples that way. A previous solution to our last design here shows the exact same syntax, yet mine gets an error...

The error happens in Universe.java, but I do have a Planet.java too so I don't see the problem with it.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Looks to me that you're likely using a 1.5+ version at school and a < 1.5 version at home. Generics weren't in Java until 1.5. Just make sure you have the same version or download a new JDK.
 

AFB

Lifer
Jan 10, 2004
10,718
3
0
Originally posted by: Descartes
Looks to me that you're likely using a 1.5+ version at school and a < 1.5 version at home. Generics weren't in Java until 1.5. Just make sure you have the same version or download a new JDK.

But then their last project wouldn't have compiled as it also uses them. I almost posted that then I noticed.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: AFB
Originally posted by: Descartes
Looks to me that you're likely using a 1.5+ version at school and a < 1.5 version at home. Generics weren't in Java until 1.5. Just make sure you have the same version or download a new JDK.

But then their last project wouldn't have compiled as it also uses them. I almost posted that then I noticed.

Yeah. I guess I could have read the entire sentence :D It's been a long week.