- 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
Convert a String to a short number in Java
Use the Short.parseShort() method in Java to convert a String to a short.
Let’s say the following is our string.
String str = “76”;
Now, the parseShort() method will convert the string to short.
byte val = Byte.parseByte(str);
Example
public class Demo { public static void main(String[] args) { String str = "76"; short val = Short.parseShort(str); System.out.println(val); } }
Output
76
- Related Articles
- Convert short to String in Java
- Convert Java String to Short in Java
- Convert Short into String in Java
- Convert string to a number in Java
- Java Program to convert String to short primitive
- Convert a String to a byte number in Java
- Convert a String to a double type number in Java
- Convert short primitive type to Short object in Java
- Java Program to convert a String to a float type Number
- Convert bytes to a string in java
- C Program to convert a number to a string
- Convert Short to numeric primitive data types in Java
- Convert a List of String to a comma separated String in Java
- Convert a Set of String to a comma separated String in Java
- Convert a floating point number to string in C

Advertisements