Short: parseShort(String s,int radix ) : Short « java.lang « Java by API






Short: parseShort(String s,int radix )

 
/*
 * Output:
The sum is 254




 */


public class MainClass {
  public static void main(String args[]) {
    String strOctal = "77";
    String strHex = "23";
    String strDecimal = "156";
    short o = Short.parseShort(strOctal, 8);
    short h = Short.parseShort("23", 16);
    short d = Short.parseShort(strDecimal, 10);
    int sum = o + h + d;
    System.out.println("The sum is " + sum);
  }
}
           
         
  








Related examples in the same category

1.Short.MAX_VALUE
2.new Short(String s)
3.new Short(short value)
4.Short: byteValue()
5.Short: doubleValue()
6.Short: floatValue()
7.Short: intValue()
8.Short: longValue()
9.Short: shortValue()
10.Short: toString()
11.Short: valueOf(String stringValue)