String can be converted into byte in java by parseInt() method. Type casting is a method to change string to byte.
Example of converting string to byte
public class StringToByteConvert { public static void main(String[] args) { String string_to_byte="124"; byte bt=Byte.parseByte(string_to_byte); System.out.println("Type cast string to byte :"+bt); } }
Output
Type cast string to byte :124
Tags: typecast



Link to Us