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

HF : method before name  RSS feed

 
patrick van merchtn
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, in my book Head First p. 62

You've got the creation of an object.



a few lines futher in this class you've got the method


My question is, it seems that he call first the method and later set a nanme. Is this ok in java, to add the name to the instance variable after you invoke the method where you need this name ?
 
patrick van merchtn
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, I see it. Of course the first time when he invoke the method there is no name assigned to the variable and the result is :
null hello.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!