why java has the size of character 2 byte ,while in c/c++ it
is of 1 byte?

Answer Posted / kunal modi

Because c/c++ is based on the ASCII
And there is only 0 to 255 characters
And 1 byte is enough for represent
256 characters (2*power8=256)
Because c/c++ only support american
Characters
But in java its used the unicode because
It carry all character exist in world
And only 3100-3200 characters present in
World and 1 byte can only store 256
Characters that's why in java char take
2 byte and it can carry (2*power16=65536)
Characters

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which class is the superclass of every class?

525


If you’re overriding the method equals() of an object, which other method you might also consider?

516


what is the package for freshers in valuelabs.

5698


What is messaging queue in java?

503


How do I run a java project in netbeans?

470






What is interceptor in java?

470


What is cache in java?

508


What is adoptopenjdk?

523


What is use of jpa?

472


Can we extract main method from another class?

516


Why doesn't lsdou work under windows nt? : java security

505


Do I need jdk or jre?

475


What does el mean in java?

525


explain how java se 8 data and time api solves issues of old java date api?

563


What is a stream in programming?

455