aspose file tools*
The moose likes Beginning Java and the fly likes .suffix and .prefix in JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".suffix and .prefix in JAVA" Watch ".suffix and .prefix in JAVA" New topic
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: 24187
    
  34

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: 39885
    
  28
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: 39885
    
  28
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: .suffix and .prefix in JAVA