Convert Short to numeric primitive data types example - Java Language Basics

Java examples for Language Basics:Primitive Types

Description

Convert Short to numeric primitive data types example

Demo Code


 
public class Main {
 
  public static void main(String[] args) {
    Short sObj = new Short("10");
    byte b = sObj.byteValue();
    System.out.println(b);/*ww  w. ja  va2s.  c o  m*/
   
    short s = sObj.shortValue();
    System.out.println(s);
   
    int i = sObj.intValue();
    System.out.println(i);
   
    float f = sObj.floatValue();
    System.out.println(f);
 
    double d = sObj.doubleValue();
    System.out.println(d);
   
    long l = sObj.longValue();
    System.out.println(l);
 
  }
}

Result


Related Tutorials