Java examples for Language Basics:byte
Convert String to Byte
public class Main { public static void main(String[] args) { //1. Construct Byte using constructor. Byte bObj1 = new Byte("100"); System.out.println(bObj1);/*from w w w . j ava2s . co m*/ //2. Use valueOf method of Byte class. This method is static. String str = "100"; Byte bObj2 = Byte.valueOf(str); System.out.println(bObj2); } }