• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

.suffix and .prefix in JAVA

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
BWA HA HA HA HA HA HA! Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic