Plz give me the right answer Intro to Java What is the order

Plz give me the right answer!

(Intro to Java)

What is the order of operations? System.out.println((double)Integer.parseInt(\"015\") + (int)3.8); Which operator is last? double + int

Solution

System.out.println( (double)Integer.parseInt(\"015\") + (int)3.8);

The last operation would be (b) +

First (double) would wait for an operand. But it\'s would encounter Integer.parseInt(\"015\") which is another operation. So this would computed first and result is feed to (double) then it would be converted to double.

Then an operator + is encountered which will again wait for an operand. But again instead an operand it will encounter another instruction (int) 3.8

So, 3.8 will be converted to integer. Now + has both operand available. So, the addition will be performed.

Plz give me the right answer! (Intro to Java) What is the order of operations? System.out.println((double)Integer.parseInt(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site