I have a doubt which follows.
public static void main(String[] args) throws IOException{ int number=1; System.out.println(\"M\"+number+1); }
Try this:
System.out.printf("M%d%n", number+1);
Where %n is a newline
%n