To write a number of type int, we can directly use the print() or println() methods:
int i = 1; System.out.println(4); System.out.println(i); System.out.println(i + 4);
Note: the symbol + can be used both for the sum of two numbers and to concatenate two strings: "aaa" + "bbb" corresponds to "aaa".concat("bbb").
Note the difference between the following two statements:
System.out.println(3 + 4); // prints 7 (as int); + denotes sum System.out.println("3" + 4); // prints 34 (as String), since the integer 4 is // first converted to a String; + denotes concat
Both statements are correct, since the method println() is overloaded: the Java library contains both a version that accepts an integer as parameter, and a version that accepts a string as parameter.