Convert String to primitive byte - Java Language Basics

Java examples for Language Basics:Primitive Types

Description

Convert String to primitive byte

Demo Code


public class Main {
 
  public static void main(String[] args) {
    String str = new String("10");
   //from  w  w  w  . ja  va  2  s . c  om
    byte b = Byte.parseByte(str);
    System.out.println(b);
  }
}

Result


Related Tutorials