Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.suffix and .prefix in JAVA

 
praveen livingstone
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys
I need urgent help with my project. I need to use this code

s[++size]=h[code].suffix;
code=h[code].prefix;

where the data type of "s" is int array whereas I dont know what data type "h" should be. when i tried it as "int", im getting this error int cannot be dereferenced. whats the problem here? should i include any import statements for solving this? what data type must "h" be?

Please help me out. URGENT
[ April 13, 2008: Message edited by: praveen livingstone ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

"h" looks to be an array of some class that has member variables named "suffix" and "prefix"; i.e.,

SomeUnknownClass[] h;

Since we don't know what "SomeUnknownClass" is, I can't tell you if import statements are needed. It might be a class you're supposed to write. Note that "suffix" and "prefix" aren't keywords in Java; they have no special meaning. They must just be variable names.
 
praveen livingstone
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks you, will look into that.

Also is there a class name Element?. I also have this problem in the coding
h[codeUsed++]=new Element(pcode,s[size]);

And this line is showing error on compiling "cannot find symbol"

is there any package/class which i should import? or it is also another user-defined class?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50258
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There obviously is a class called Element. You can try going through the API documentation, where "Element" appears five times, but I suspect, as Ernest is hinting, that it is either a class you have to write yourself, or a class your teacher is giving you.

You haven't provided enough information for us to help you properly, and I think you need to go back to whoever set the assignment and ask for more information about where to find these classes. Have you got a sheet of instructions for your project? Does it say anything about Element or what "h" is?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50258
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think any of the 5 Elements I found matches your code, so it is obviously something you have to write yourself, OR something your instructor has provided. And "h" would appear to be an array of Elements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic