If I use int d = 0; d=d+2*Math.pow(2,2) it create error but if i use d += 2*Math.pow(2,2) it does not create error Why?

Please tell the difference between
d=d+2Math.pow(2,2) and d += 2Math.pow(2,2) and also tell why
d=d+2Math.pow(2,2) has error

Both are correct. Just if you want to use

d=d+2Math.pow(2,2)

Use proper brackets and * signs

after using proper brackets and * sign , error remains . please write these three statements in your eclipse IDE and resolve my doubt why d=d+2Math.pow(2,2) need to type cast and d += 2Math.pow(2,2) not

hey @masdd
refer to this


you need to convert math.pow to int and add proper brackets and * and both of these work :slight_smile: