hi ranchers ! i have a problem in casting the double data type into the string type. i have write a code as double i=100*Math.random(); String a=i.toString(); but it is throwing an error .please give anybody give the suggestion that how i can convert a random number into a string type. thanks in Advance Amar Deep Chaudhary
"A thinking mind never dies"
Joined: Feb 07, 2005
You can't call a method on a primitive.
If you look at the String API, you will find an overloaded method called valueOf that will let you convert any type to a String.
Joined: May 29, 2004
Moreover if you want a more strict control over type you can use also