集册 Java实例教程 将字符串转换为原始字节

将字符串转换为原始字节

欢马劈雪     最近更新时间:2020-01-02 10:19:05

502
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将字符串转换为原始字节


public class Main {

 
 /*
  from N o w J a v a . c o m 
 */

  public static void main(String[] args) {

    String str = new String("10");

   

    byte b = Byte.parseByte(str);

    System.out.println(b);

  }

}