Java String getBytes()The java string getBytes() method returns the byte array of the string. In other words, it returns sequence of bytes. SignatureThere are 3 variant of getBytes() method. The signature or syntax of string getBytes() method is given below: Internal implementationReturnssequence of bytes. Java String getBytes() method exampleOutput: 65 66 67 68 69 70 71 Java String getBytes() Method Example 2This method returns a byte array that again can be passed to String constructor to get String. Output: 65 66 67 68 69 70 71 ABCDEFG Next TopicJava String getChars()
|