I have this following code:
Scanner scan = new Scanner(System.in);
System.out.print("Enter number 1: ");
int num1 = scan.nextInt();
System.out.print("Enter number 2: ");
int num2 = scan.nextInt();
System.out.print("Enter number 3: ");
int num3 = scan.nextInt();
if (num1 < num2 && num2 < num3) { // Checks if the numbers are in increasing order
System.out.println("Increasing: " + num1 + num2 + num3); // Prints them in increasing order
Logger.getGlobal().info("\n\nThis step works!"); // If 3rd is highest, 2nd is mid and 1st is lowest
}
I was wondering, is it possible to put the println in a loop such that it increases num1 to num2 then num3? I know that in my case I should just use the concatenation instead of loop. But I was just curious if I wanted to try big numbers, was it possible to change the names of variable (increase "1" to "2" and so on in num1 and num2 and ...) in a loop? Or is it not and I have to stick with concatenation?
Thanks.