FloatTest.java



/** float型,double型のデータを取り扱う */
public class FloatTest {

  /** 処理の開始 */
    public static void main( String[] argv ) {

        float f = (float)Math.PI;
        System.out.println( "float  value = " + f );
        double d = Math.PI;
        System.out.println( "double value = " + d );

        f = 1.0f/3.0f;
        System.out.println( "float  value = " + f );
        d = 1.0/3.0;
        System.out.println( "double value = " + d );
    }
}