Loop in Java
A Java loop is used to repeat a section of code several times. Sometimes we know how many iterations there are, and sometimes we don’t. For instance, if you want to display numbers from 1 to 10, you can use a loop, and if you want to print anything several times, you can also use…