parseShort() Method in java

Java Programming Language Number Class in java (Article) Number Class in java (Program)

963

Program:

 
public class ParseShort {

   public static void main(String args[]) {

      short x =Short.parseShort("2");

      System.out.println(x);

   }
}

/*

This method is used to get the primitive data type of a certain String.
parseShort(String s) - This returns an short (decimal only).
s - This is a string representation of decimal.

*/

Output:

2
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.