Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

assign null to double  RSS feed

 
Sam Venkata
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to assign null value to a variable declared double in my application is there a way to do it?
I tried to assign a null value but it does not accept.

Thanks,
Samanth.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Double" (with an uppercase 'D') is an object that wraps a primitive value. As an object, it can be assigned a null reference.

But "double" (with a lowercase 'd') is a primitive type, so it cannot be assigned a null reference. The analogous primitive value is simply zero.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!