>when it is necessary to include a return statemnt in one's code
When you're returning from any function whose return type is not void.
>what is the difference between recursion and iteration?
At what level? At the highest level, there's no difference. Go a bit lower and recursion is just a more flexible form of iteration. Go down to the client level and recursion is a series of nested function calls while iteration is just a glorified goto loop. Go even deeper and recursion is an execution stack where stack frames are piled on top of each other and the instructions that operate on each frame happen to be the same while iteration is nothing more than conditionally jumping around the same instructions within one stack frame.
A loop can repeat a series of instructions only if each iteration immediately follows the previous one right? But in case of recursive functions, you can call the function at any point of the program and the series of instructions will be executed right? So can you say that the point I made is the difference between them?
>So can you say that the point I made is the difference between them?
No. I don't see how the two statements describe a difference unless you're adding the restriction that only one loop can be used ever and it can't be placed in a function.
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...