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 : 80
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!