public
byte[] getBytes()
Encodes
this String into a sequence of bytes using the platform's default
charset, storing the result into a new byte array.
class StringGetBytes{ public static void main(String args[]){ String s1 = new String("wxyz"); byte b[] = s1.getBytes(); System.out.println("s1 = " + s1); System.out.println("Bytes are"); for(byte b1 : b) System.out.print(b1 + " "); } }
Output
s1 = wxyz Bytes are 119 120 121 122
No comments:
Post a Comment