Displaying variables in a string?
Hello everyone. im obviously new to java but im having some trouble displaying some predefined variables i have. I am supposed to write a simple program to compare 2 numbers and then display the larger number following the text "is larger"...this is my code thus far. It gives me trouble in the line where i have to display the variable number with "is larger". cant figure out how i would display this...
System.out.print( "Enter first integer:");
number1 = input.nextInt();
System.out.print ("Enter second integer:");
number2 = input.nextInt();
if (number1 == number2)
System.out.print("These numbers are equal.");
if (number1 > number2)
System.out.print(number1," is larger.");
if (number2 > number1)
System.out.print(number2," is larger.");
the red is what im having trouble with..