aspose file tools
The moose likes Beginning Java and the fly likes Why char type in java is is having 2 byte of memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Why char type in java is is having 2 byte of memory?" Watch "Why char type in java is is having 2 byte of memory?" New topic
Author

Why char type in java is is having 2 byte of memory?

Bhavesh Sangwan
Ranch Hand

Joined: Aug 08, 2012
Posts: 42
I mean prior to java, all programming languages were using only 1 byte of memory for CHAR datatype. Then why java offered 2 bytes..?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
Prior to Java, no programming language supported Unicode easily; Java does, thus allowing you to handle text in most of this planet's languages and scripts without much work on your part. Pretty cool, huh?


Android appsImageJ pluginsJava web charts
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32668
    
    4
And to add to what Ulf said, when Java was first developed, all Unicode characters occupied 16 bits = 2 bytes.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Why char type in java is is having 2 byte of memory?
 
Similar Threads
Storing serialized objects
Help in Final variables
Data Types
question on unicode
byte size of a string?