how to make a loop in java
for (int i = 0; i < 3; i++) {}
for loop java
for(/*index declaration*/int i=0; /*runs as long as this is true*/
i<=5; /*change number at end of loop*/i++){
doStuff();
}
java for loop
// Example of a for loop in java that will iterate the number of times entered by the user
import java.util.Scanner; // import Scanner class
public class grepperjava {
public static void main(String[] ARGS)
{
System.out.println("\nPlease enter a number, and the loop will iterate input times.");
int input;
Scanner var = new Scanner(System.in); // Create scanner object, so user-input may be read
input = var.nextInt();
var.close();
for(int i = 0; i < input; i++)
{
System.out.println("This will print " + input + " times");
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us