Java Using Wrapper Methods

Java Using Wrapper Methods


Using Wrapper Methods In Java
Now we will study the methods used in wrapper class the list of methods is given as follows - 
These methods are used to fetch the values associated with corresponding wrappers.
  1. shortValue() 
  2. longValue()
  3. floatValue() 
  4. doubleValue()
  5. intValue()
  6. byteValue() 
  7. charValue()
  8. booleanValue()
  9. toString()
The above mentioned 9 methods now we will see example using these methods - 
Example - 
import second.*;
import java.util.*;

class Main {

  public static void main(String[] args) {
// using wrapper methods here
      Integer i = 44;
      Double d = 3.14;
      Character c = 'M';
      System.out.println(i.intValue());
      System.out.println(d.doubleValue());
      System.out.println(c.charValue());

      // Now using toString methods -
      System.out.println("the using toString() methods.......");

String str = i.toString();
System.out.println(str.length());

  }
  }

 
Output -