fork download
  1.  
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class MyStringBytes {
  8. public static void main(String a[]){
  9. String str = "core java api";
  10. byte[] b = str.getBytes();
  11. System.out.println("String length: "+str.length());
  12. System.out.println("Byte array length: "+b.length);
  13. }
  14. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
String length: 13
Byte array length: 13