English subtitles

← Defining vs Calling a Method

Get Embed Code
13 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. Let's do the first task.
  2. I'm going to change the name of
    the display method to displayquantity.
  3. Now this causes some errors in our app.
  4. If I scroll up I see an error that says
    cannot resolve method display int.
  5. This is actually related
    to the second task,
  6. where we asked if you need to change
    the way that the method is called.
  7. The answer is yes, because when
    we change the name of the method,
  8. we need to change the way
    that it's called.
  9. So, in the increment method, I'm going
    to change this to say displayQuantity,
  10. and then decrement method,
  11. I'm going to change this to
    say displayQuantity as well.
  12. Now there's no more
    errors in our app and
  13. I can save this and
    then run the app on the device.
  14. And the app works as expected.
  15. There's no user visible change,
    but internally,
  16. in our code,
    we did change the method name.