The valueOf method revisits the pertinent Number Object possessing the value of the argument bypassed. The argument can be a prehistoric data type, String, etc. This process is a still method. The method can pick two arguments, where the initial is a String and the next is a radix.
Following are all the variants of this method:
static Integer valueOf(int i) static Integer valueOf(String s) static Integer valueOf(String s, int radix)
Here is the detail of parameters −
public class Test { public static void main(String args[]) { Integer x =Integer.valueOf(9); Double c = Double.valueOf(5); Float a = Float.valueOf("80"); Integer b = Integer.valueOf("444",16); System.out.println(x); System.out.println(c); System.out.println(a); System.out.println(b); } }
This will produce the following result:
9 5.0 80.0 1092
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.