Fill This Form To Receive Instant Help
Homework answers / question archive / Java Discussion Response Class
Java Discussion Response
Class.
The funny thing about programming is that you can have a method call itself! This actually creates a situation like a hall of mirrors that must be used very carefully. However, when done properly. it can enable us to work smarter instead of harder.
Page (2013) has an excellent online tutorial that is listed in your classroom materials for this week. Page states:
This is a one off post that will educate you on a fairly complex topic in programming. I'd like to preface this by saying that the need to use Java recursion programming does not come up often. I think in my entire professional career I've used one recursive algorithm, though your mileage may vary of course.
So what is Java recursion? In computer programming its the process of having a method continually call itself until a defined point of termination.
Lets consider the following recursive code.
01. public int nyRecursiveMethod () 02. { 03. int Wadable • myRecursiveMethoo(); 04. 1
I also agree with Page that recursion is very infrequently used in programming because of the massive headache that it causes when debugging. However, it did come in useful for protocol parsing and validation if you ever write your own firewall from scratch at a driver level.
See if you can answer some of these questions:
• So what would happen if we called this myRecursiveMethod() from main()? • How would it affect the CPU? • What important thing is missing from this recursive method?