
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert String to Short Primitive in Java
Use the parseShort() method to convert String to short primitive. It parses the string argument as a signed short.
Firstly, we have set a string.
String str = "99";
Now, we have taken a short primitive and included the string value.
short val = Short.parseShort(str);
The following is an example to convert String to short primitive.
Example
public class Demo { public static void main(String []args) { String str = "99"; short val = Short.parseShort(str); System.out.println(val); } }
Output
99
Advertisements