This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Kiran, Even i dont know much about the working of this. I checked into API, it says
System.out.println(<float value> is same as Float.toString(<float value>
In the method toString() of Float class they have explained various scenarios. Its quite detailed and u need patience to go thru it. This is what they have told regarding the digits after decimal part
How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type float. That is, suppose that x is the exact mathematical value represented by the decimal representation produced by this method for a finite nonzero argument f. Then f must be the float value nearest to x; or, if two float values are equally close to x, then f must be one of them and the least significant bit of the significand of f must be 0.
I didnt understand what they said, So let someone try and make us understand
Print a floating-point number. The string produced by String.valueOf(float) is translated into bytes according to the "platform's default character encoding",and these bytes are written in exactly the manner of the write(int) method.
Shivu<br />(SCJP1.4,SCBCD(In Progress..)<br />We are what we think.