[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Program Help!!  XML
Forum Index » Java Programming
Author Message
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

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!
aim icon
destin

Newbie
[Avatar]
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!
[Email]
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!!
destin

Newbie
[Avatar]
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.
[Email]
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
destin

Newbie
[Avatar]
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?
[Email]
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle