File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes The Package In Which Primitives Are Defined? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "The Package In Which Primitives Are Defined?" Watch "The Package In Which Primitives Are Defined?" New topic

The Package In Which Primitives Are Defined?

Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
Which java package are primitives (boolean, byte, char, ..... , double, float) defined?
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
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

SCJP 1.4
Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 325
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

Joined: Jan 29, 2003
Posts: 8791
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?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this fancy talk to the Intermediate forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
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'm not back." - Bill Harding, Twister
jQuery in Action, 3rd edition
subject: The Package In Which Primitives Are Defined?
It's not a secret anymore!