
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 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
Advertisements