Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting an Object to a Character?  RSS feed

 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to convert something of type Object to a Character?
[ April 01, 2004: Message edited by: Brandi Love ]
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All Objects have a toString() method which will give a String of characters represnting the object in printable form.
An Object of type Character can be turned into a char primitive with its charValue() method:
char c = myCharacter.charValue();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!