Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

default values or specifics  RSS feed

 
Elouise Kivineva
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a project and I'm trying to show how the cattledrive has taught me all sorts of manners
(they got me all dusted off and wearin' shoes even!)
I wrote
this.children = new TreeNode[ 6 ] ;
Is it good enough to know or to mention that these Objects should all receive an initial value of null because that is the default value of an Object, or would manners and caution dictate that I run through the array and initialize each Object to null.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to run through a new array and initialize everthing to null. Folks that program in Java already know what the components of a new array are initialized to.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!