Java String internal representation -


i understand internal representation of java string utf-16. java string representation?

also, know in utf-16 string, each 'character' encoded 1 or 2 16-bit code units.

however, when debug following java code

string hello = "hello"; 

the variable hello array of 5 bytes 0x48, 0x101, 0x108, 0x108, 0x111 ascii "hello".

how can be?

i took gcore dump of mini java process code:

 class hi {     public static void main(string args[]) {         string hello = "hello";         try {             thread.sleep(60_000);         } catch (interruptedexception e) {             e.printstacktrace();         }      } } 

and did gcore memory dump on ubuntu. (usign jps pid , passed gcore)

if found this: 48 65 6c 6c 6f in dump using hexeditor, somewhere in memory ascii.

but 48 00 65 00 6c 00 6c part of utf-16 representation of string


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -