Java Articles

Submit Article
Home » Articles » Java » FundamentalRSS Feeds

Short Wrapper Class

Posted By: Mohammad Evans     Category: Java     Views: 14310

This article explains about Short wrapper class in java.

Short wrapper class is used to wrap primitive data type short value in an object. 

Examples of Short Wrapper Class

Example 1 : Convert short data type to Short object 

public class shortToShort
  public static void main(String[] args) 
    short s = 1;
    Short sObj = new Short(s);


This example shows how a short data type value can be converted to short object.

Example 2 : Convert String to Short object 

public class StringToShort
    public static void main(String[] args)   
        Short s1 = new Short("1");    
        String str = "2";    
        Short s2 = Short.valueOf(str);    


This example shows how we can convert String object to Short object.


Didn't find what you were looking for? Find more on Short Wrapper Class Or get search suggestion and latest updates.

Mohammad Evans
Mohammad Evans author of Short Wrapper Class is from London, United Kingdom.
View All Articles

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!