java - double field type declaration as zero -


what significant difference between following 0 double variable declaration: 0.0 vs 0d

double d1 = 0.0; double d2 = 0d; 

i understand both these better 0,because more obvious code reader.

however 0.0 vs 0d difference not clear me.

there no difference. have @ java language specification, section 3.10.2

decimalfloatingpointliteral:

  1. digits . digitsopt exponentpartopt floattypesuffixopt
  2. . digits exponentpartopt floattypesuffixopt
  3. digits exponentpart floattypesuffixopt
  4. digits exponentpartopt floattypesuffix

...

floattypesuffix: 1 of

f f d d 

both decimalfloatingpointliteral, first 1 type 1, second 1 type 4


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -