Because that's how it is implemented, because + is both used for adding numbers, as for String concatenation.
The first time, neither of the parts is a String, but both are numerical values that can be added, so it's used to add the values.
But, as soon as one part of the two is a String, it is used for String concatenation.
Change your code like this:
String s=10+30+" Sachin "+(40+40);