my problem is asking me to write a program that reads a value (say n) from the user and outputs Hello World n times. Verify that the user has entered an integer. If the input is 3, the output will be Hello World printed three times.
I have gotten this far and i hope it is correct but once i get the number from the user it will not print Hello World that number of times what steps am i missing?
Thanks in advance
import java.util.Scanner;
public class HelloWorld
{
public static void main (String[] args)
{
Scanner scan = new Scanner( System.in);
System.out.println("Enter a number as a integer");
{
}
int x = scan.nextInt();
System.out.println("Hello World");
}
}