Java Programming Tutorial - 16 DOUBT

+2 allen george · December 26, 2014
you didn't call the getName method, will it run? if yes then why do we have to call the other methods. if no, then why did you put it there if your not going to use it.

Post a Reply


Oldest  Newest  Rating
0 allen george · January 8, 2015
0 Pere Garau Burguera · December 28, 2014
He does call the getName method. If you look carefully, he uses it within the saying method. The saying method just outputs that text and replaces the %s with whatever you pass the printf method as a second parameter. He puts getName(), and this method will return whatever the String girlName equals. 
Then, you will see that he uses that saying method within the main method, so the saying method will get called, and therefore, the getName method will also get called. So he is using all the methods he created, but for the getName, he doesn't call it directly, but he does call it within the saying method.
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator