File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The Package In Which Primitives Are Defined?

 
Natalie Kopple
Ranch Hand
Posts: 325
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which java package are primitives (boolean, byte, char, ..... , double, float) defined?
 
Rob Ross
Bartender
Posts: 2205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The primitive types are part of the language, not the libraries so you won't find a definition for them in any packages like with java.lang.Integer, for example.
That's like asking, in what package is the "for" keyword defined?
But if you are really asking that, I guess I'd say look in the Java Language Specification
 
Natalie Kopple
Ranch Hand
Posts: 325
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I should have explained my questions better. I am working on a configuration file. And I am stuck in giving a "type" to primitives.

firt name and last name are String(s). Is logon_date of java.util.Calendar type?
The cumulativeGPA is a double and the subscriber is a boolean, how do I specify their type in the configuration file?
[ July 03, 2003: Message edited by: Natalie Kopple ]
[ July 03, 2003: Message edited by: Natalie Kopple ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing somewhere you use Class.forName(x).newInstance() or reflection to create object instances of the named classes. If so you'll have to specify object wrappers, ie the java.lang.Double class instead of the double primitive. Or write some special code that looks for the primitive types and takes a different approach.
Is that how you're using this info?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this fancy talk to the Intermediate forum...
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stan is probably correct. It really depends on what is being done with these properties - there's an excellent chance that you can't user primitives, and will have to use the corresponding wrapper classes instead. However it's also possible (if the properties-processing code is sufficiently flexible) that actual primitives are allowed here. If so, the only appropriate syntax would be to just say type="double" rather than trying to prefix a package name onto the type. Primitives have no package, period. If the code doesn't accept that, you probably just can't use primitives here.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic