Convert String to byte in Java
Description
The following code shows how to convert String to byte.
Example
// w w w.j a v a 2s . com
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 »