System.out.println behavior when using String and int together [duplicate]
问题 This question already has answers here : Java String Concatenation with + operator (5 answers) Closed 1 year ago . Consider the below code snippet - public class Student { public static void main(String args[]) { int a = 3; int b = 4; System.out.println(a + b +" "); System.out.println(a + b +" "+ a+b); System.out.println(""+ a+b); } } The output for the above snippet is coming as - 7 7 34 34 It is clear from the output that if we use String at first in the print statement then the integers