How to convert String object to primitive short in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        String str = new String("33");

        short s = Short.parseShort(str);
        System.out.println(s);
    }
}
   
/*
      
run:
      
33
  
*/

 



answered Nov 7, 2016 by avibootz
...