aspose file tools*
The moose likes Java in General and the fly likes String object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "String object" Watch "String object" New topic
Author

String object

Bhayajis Bhayajis
Greenhorn

Joined: Sep 29, 2003
Posts: 9
Is there any valid reason why byte, long, float, double, int, short and char are primitive types and not String (which is an object)
Tom Wolve
Ranch Hand

Joined: Sep 22, 2003
Posts: 32
Convenience is a reason maybe not a valid one.
I prefer writing (and reading) instead of
[ October 16, 2003: Message edited by: Tom Wolve ]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Shouldn't the question in an Object Oriented language be "Is there any valid reason why byte, long, float, double, int, short and char are primitive types?"
but back to your question, if String was a primitive, it wouldn't be able to have any methods ( because primitives can't have methods! ). So if you remove all the methods, and supporting class functionality, what are you left with?
char[] ! which is a primitive array!
actually, I don't think that's the real reason, but I digress
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String object