This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Memory problem with uninitialized static member variable  RSS feed

 
Mathew Kuruvilla
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was asked an interview question.
"What is the memory implications if the static member in a Class is not initalized"

I replied that static members are initialized to null. Clearly this was wrong, because
he went on to his next question . . .
 
Lakshman Arun
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class variables(static variables), Objects datamembers(non-primitive) are assigned to null by default. Assigned to the corresponding default values(0 or false) if its primitive.

Regards
Lakshmanan
 
Mathew Kuruvilla
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what I thought. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!