| Author |
.suffix and .prefix in JAVA
|
praveen livingstone
Greenhorn
Joined: Apr 13, 2008
Posts: 7
|
|
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
Joined: Jul 08, 2003
Posts: 24057
|
|
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.
|
[Jess in Action][AskingGoodQuestions]
|
 |
praveen livingstone
Greenhorn
Joined: Apr 13, 2008
Posts: 7
|
|
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
Joined: Oct 13, 2005
Posts: 32689
|
|
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
Joined: Oct 13, 2005
Posts: 32689
|
|
|
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.
|
 |
 |
|
|
subject: .suffix and .prefix in JAVA
|
|
|