- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert String to short primitive
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
- Related Articles
- Convert short primitive type to Short object in Java
- Convert Short to numeric primitive data types in Java
- Java Program to convert a Primitive Type Value to a String
- Convert short to String in Java
- Convert Java String to Short in Java
- Program to convert Primitive Array to Stream in Java
- Java Program to convert a string into a numeric primitive type using Integer.valueOf()
- Java Program to convert Java Float to Numeric Primitive Data Types
- Java Program to convert Double to numeric primitive data types
- Convert a String to a short number in Java
- Convert Short into String in Java
- C++ Program to convert primitive types to objects
- Golang program to convert primitive types to objects
- Convert Java Boolean Primitive to Boolean object
- Java Program to Convert Character to String

Advertisements