| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/13/2006 14:07:50
|
sufs2000
Newbie
Joined: 12/19/2005 09:41:49
Messages: 14
Offline
|
im really stuck on this, i was given 2classes, a car and garage..i wasnt allowed to change any method or field names i was only allowwed to alter the code in the brackets and i keep gettin errors..the two classes are shown below..can anyone see any problems??..it says "identifier expected<identifier>" for the field in the second class "Garage" called"private ArrayList<Car> cars;"
can anyone help me??..Thanks
This message was edited 2 times. Last update was at 03/12/2006 10:21:01
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/13/2006 15:34:20
|
tfecw
Newbie
Joined: 09/19/2005 15:02:20
Messages: 144
Location: No. VA.
Offline
|
While it doesn't seem like when you first start out, java errors are extremely helpful once you get the hang of them.
Please post the full stack trace, espically the line number. Also, somehow signify the lines affected in your code.
Thanks!
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/13/2006 17:44:32
|
destin
Newbie
Joined: 01/07/2006 19:13:04
Messages: 224
Offline
|
Hmm. I can think of two possible reasons you're getting this error.
1) Car and Garage are not in the same package, and it doesn't recognize Car.
2) You haven't uprgraded to Java 5, and the compiler doesn't recognize the new syntax.
But yes, as tfecw said, please post the full stack trace. Thanks!
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/14/2006 04:36:49
|
sufs2000
Newbie
Joined: 12/19/2005 09:41:49
Messages: 14
Offline
|
ive wrote error where the errror message "identifier expected<identifier>" . its in the second chunk of code at the top in the fields list. i dont know what ive done wrong with the array??..and also i dont understand what you mean by the two classes are not in the same package??..cheers!!
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/14/2006 05:05:58
|
destin
Newbie
Joined: 01/07/2006 19:13:04
Messages: 224
Offline
|
sufs2000 wrote:ive wrote error where the errror message "identifier expected<identifier>" . its in the second chunk of code at the top in the fields list.
Right, but we want to see the whole stack trace.
sufs2000 wrote:i dont understand what you mean by the two classes are not in the same package??..cheers!!
I mean that in one class you might not have access to the other. It's like trying to use ArrayList without importing the java.util package. If the two classes are in the same file you won't get a problem.
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/14/2006 05:34:04
|
sufs2000
Newbie
Joined: 12/19/2005 09:41:49
Messages: 14
Offline
|
oh sorry..lol..i duno what the whole stack trace is??..oh and yea the garage and car class are in the same file..im sure of it..shal i try n make a new file and copy and paste into the new1, would that help??..thnx
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 03/12/2006 10:22:17
|
destin
Newbie
Joined: 01/07/2006 19:13:04
Messages: 224
Offline
|
Looking back on it, I'm almost positive it's because you haven't upgraded to Java 5. What IDE are you using?
|
|
|
 |
|
|