Tuesday, 24 June 2014

valueOf (float f)

public static String valueOf(float f)
Returns the string representation of the float argument.

class StringValueOfFloat{
 public static void main(String args[]){
  float var1 = 10.01f, var2 = 11.11f;
  
  String str1 = String.valueOf(var1);
  String str2 = String.valueOf(var2);
  
  System.out.println("str1 = " + str1);
  System.out.println("str2 = " + str2);
 }
}

Output

str1 = 10.01
str2 = 11.11


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment