Use parentheses as follows
System.out.println((i+1) + " " + (j+1));
From docs
The + operator is syntactically left-associative, regardless of whether it is later determined by type analysis to represent string concatenation or append. In some cases, care is required to obtain the desired result. For example, the expression:
a + b + c is always considered to mean: (a + b) + c
Extension of this scenario
i+1 + " " + j+1
he becomes
(((i + 1) + " ") + j)+1
Since it iis int so (i + 1) = 1, a simple addition
" " String, ((i + 1) + " ")= 1 ( )
, j 1, String String , , .