I have a doubt which follows.
public static void main(String[] args) throws IOException{ int number=1; System.out.println(\"M\"+number+1); }
Add a bracket around your sum, to enforce the sum to happen first. That way, your bracket having the highest precedence will be evaluated first, and then the concatenation will take place.
sum
bracket
concatenation
System.out.println("M"+(number+1));