Can a for loop be written in Java to create an infinite loop or is it only while loops that cause that problem?
you can declare a subpart of the code to be another part in a for loop, example -
public class (classname) {
for(int i = 1; i <= 4; i++) {
for(int j = 1; i <= 4; j++) {
system.out.println(i + "*" + j + "=" (i*j));
}
}
it is almost in infinite loop; if you change int to long, and add more variables, you can practically make it last 25 x 10^12 minutes long