This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes storing an array in a meathod problem... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "storing an array in a meathod problem..." Watch "storing an array in a meathod problem..." New topic
Author

storing an array in a meathod problem...

Jim Nobert
Greenhorn

Joined: Jan 17, 2003
Posts: 4
Hello everyone,
I'm having a little difficulty trying to get a String to store a value to a StringBuffer. I'm thinking that I need to transfer the StringBuffer named major to major.toString however I need to assign it to a specific element named index.
The error I am recieving is "Not an Expression Statement at Line 82."

Well anyway. Maybe someone could help me with the probable brain fart I am having. Any help would be greatly apperciated.
Thanks
Jim
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986


This is not an assignment.
[ April 01, 2003: Message edited by: William Barnes ]

Please ignore post, I have no idea what I am talking about.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

And! You don't want to say "major[ index ]", as major isn't an array.
Jim Nobert
Greenhorn

Joined: Jan 17, 2003
Posts: 4
Yes major is an array... its in line 6.
Jim Nobert
Greenhorn

Joined: Jan 17, 2003
Posts: 4
William,
I realize it is not a statement... but however, this is the logic that I was thinking in order to perform the task, that is my whole problem
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I don't know which line is Line 82. Can you please point it out so that we can help you pin point the error. If the line is the one indicated by William, then maybe you need to describe exactly what you meant by that line of code. That should help you determine how to change it.
[ April 01, 2003: Message edited by: Layne Lund ]

Java API Documentation
The Java Tutorial
jon ladd
Ranch Hand

Joined: Feb 11, 2003
Posts: 53
As you see at the top of the code major is declared as a StringBuffer array and in using the logic he has already in line 82 which is array[index] == major; which says not an expression statement we are both really baffled by this. Any point on correct logic would be great.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

What you probably meant was either

OR

Your "array[index] == major[index]" is just a logical expression that is hanging loose there.
Eugene.
[ April 01, 2003: Message edited by: Eugene Kononov ]
Jim Nobert
Greenhorn

Joined: Jan 17, 2003
Posts: 4
Thanks for the help everyone... I think I got it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: storing an array in a meathod problem...