Convert String to byte in Java
Description
The following code shows how to convert String to byte.
Example
//from w w w . j av a 2s . c om
public class Main {
public static void main(String[] args) {
String str = new String("10");
byte b = Byte.parseByte(str);
System.out.println(b);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »