WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Java - valueOf() Method


Returns an Integer object holding the value of the specified primitive.


Syntex

static Integer valueOf(int i)
static Integer valueOf(String s)
static Integer valueOf(String s, int radix)

Parameters

what is mean of ch?

i − An int for which Integer representation would be returned.
s − A String for which Integer representation would be returned.
radix − This would be used to decide the value of returned Integer based on the passed String.

Example

public class Test { 

   public static void main(String args[]) {
      Integer x =Integer.valueOf(10);
      Double c = Double.valueOf(20);
      Float a = Float.valueOf("400");               
      Integer b = Integer.valueOf("200",15);

      System.out.println(x); 
      System.out.println(c);
      System.out.println(a);
      System.out.println(b);
   }
}

Output
10
20.0
400.0
450

Run example »