No, it is saved in the form of bytes.
Probably you just did not realize it. It's possible that you don't understand what the byte is and how it is presented. If you think that the "byte" would look in the file read by some text editor, something as "0x2F", think again. Or, if you need that, format each byte as a string (2 or 4-character, as in this example) and output the resulting string. Right now, you can see those the bytes in some binary editor.
Also, you need to understand that your "may name is rahul" is represented in Unicode, and the result of
String.getBytes
is "a sequence of bytes using the platform's default charset, storing the result into a new byte arra":
http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#getBytes%28%29[
^].
This is not very good due to this uncertainty. To be more certain, you would need to specify exact
encoding. For further detail, please see this tutorial:
https://docs.oracle.com/javase/tutorial/i18n/text/string.html[
^].
For example, if you choose UTF-16, you will get two bytes per characters. With UTF-8, you get variable number of strings per characters, and full Unicode
character repertoire can be covered. With ASCII, you will get exactly one byte per character, but ASCII works only for code points below 128 (less or equal to 127). As in your example all characters fit in the ASCII range, you will get 1 byte per character, same bytes for ASCII and UTF-8, but other characters not supported by ASCII, in case you use it, may be replaced with '?', which is unacceptable. So, always use UTFs for all general-purpose strings.
—SA