Tutorials

Java String Methods


String valueOf() method


In java String valueOf( ) method converts different types of values like int, float, double or others to String.

 

Example:


public class ValueOfDemo {

      public static void main(String[] args) {

            int a = 100;
            String strA = String.valueOf(a);           

            double d = 13.01;
            String strD = String.valueOf(d);
          
            char c = 'A';
            String strC = String.valueOf(c);
         
            System.out.println(strA+strC+strD);

      }
}

 

OUTPUT:

100A13.01



Please Share this page
Views : 52