public class MainOutput{ public static void main(String[] args) { String message1 = "Hello"; String message2 = "Goodbye"; System.out.println(message1 + " " + "John" + '!'); System.out.println(message2); int a = 1; int b = 2; int c = 3; int d = 4; System.out.println(a + b + c + d); // The first multiplication at the left-side executes first. The result of the expression is a String("1,"). // in result, the second multiplication shall have a String at the left-side and an int at the right-side. In result, // the type of the second expression becomes a String("1,2"). And this process continues... // The value of the third expression: "1,2," // The value of the fourth expression: "1,2,3" // The value of the fifth expression: "1,2,3," // The value of the sixth expression: "1,2,3,4" System.out.println(a + "," + b + "," + c + "," + d); } }