Methods that return a value

PRETTY MUCH THE SAME.
except totally different.


In the past, you've declared, used, and worn out already defined methods and manually defined methods. But never before have you had it return a value for use elsewhere! Now, here in the world of the future, you can create your own methods that return values for use in other programs or elsewhere in your code!


I'll show you an example and define how it all works.





Notice on line 19 how I typed 'public static double' instead of 'public static void'?
Well that's because this particular method is going to return a value as a double whenever the method is called, and it can be called outside of the class. 

1 comment:

  1. I wonder if theres a video to this
    if so Thanks!

    ReplyDelete