/*
* Copyright © 2008 - 2009 it.ibluespace.com. All rights reserved.
*/
public class StringToByteConverter
{
public static void main(String args[])
{
String str = "58";
//approach 1: to convert String to byte
byte b1 = Byte.parseByte(str);
System.out.println( "b1 = " + b1 );
//approach 2: to convert String to byte
byte b2 = Byte.valueOf(str);
System.out.println( "b2 = " + b2 );
}
}
|