Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String object

 
Bhayajis Bhayajis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic