30 hello 1020 example

Can you explain in detail

Does it work L to R ??

@pallavigoel1996,

See in Java when you are printing something and you add a string after it say “hello”, everything after hello will be seen as a string only.

in case of 10+20+“hello”+10+20, the system computes the value of 10+20 which is 30 and currently everything encountered is an int. After it sees hello, everything after that becomes a string too. Now the 10 after hello is not an int anymore, it is seen as a string. Hence we only print it as 10, followed by 20 which is also seen as a string now.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.