I have the below code producing this output (no space after -1) ==> \"1 3 -14 -15 -1\"
int [] arr = {1, 3, Integer.MAX_VALUE, 4
You missed to put the operation within parenthesis, so it is behaving weirdly, use below code,
try{
throw new ArithmeticException("Exception Testing...");
}catch(Exception e){
String msg = "First Statement : " + (e.getCause() != null ? e.getMessage() : null);
System.out.println(msg);
}
In case you need any other help or explanation on this . Please let me know.