Hi,

What is the default value of float and double datatype in Java?

Its my interview question anyone know the correct answer?

anyone..

If you really wish to find out then declare a float and a double. Then print them to the screen.

e.g.

public class Test{

    private float myFloat;
    private double myDouble;

    public static void main(String[] args)
    {
        System.out.println("Float: " + myFloat);
        System.out.println("Double: " + myDouble);
    }
}

ObSys: if you do feel the need to hand out code, at least make it code that will compile.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.