WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

johnmecanse34


Registered Member
Registered Member
Hi,

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

Its my interview question anyone know the correct answer?


http://www.javatrainingchennai.co.in/

Peter Michael


Registered Member
Registered Member
It's not always necessary to assign a value when a field is declared. Fields that are declared but not initialized will be set to a reasonable default by the compiler. Generally speaking, this default will be zero or null, depending on the data type. Relying on such default values, however, is generally considered bad programming style.


Default Value Are

float       0.0f
double     0.0d

anilkumartgsb


Registered Member
Registered Member
Default value is that value in a program which is been taken or assign automatically to a variable by the compiler when no pre value has been assigned to that variable by the user.
Default value in Java for float and double data type are : float 0.0f,  double 0.0d. Every data type has some default value and in case if no pre value has been given you need to use that default value of that data type. One should remember this concept while solving programmatical problems.

http://www.tgsb.in/web-design/gurgaon

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum