String can be converted into short in java by parseShort() method. Type casting is a method to change string to short.
Example of converting string to short
public class StringToShortConvert { public static void main(String[] args) { String string_to_Short="1234"; short shrt=Short.parseShort(string_to_Short); System.out.println("Type cast string to short :"+shrt); } }
Output
Type cast string to short :1234
Tags: typecast



Link to Us