About Question enthuware.ocajp.i.v8.2.1111 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Sergio
Posts: 7
Joined: Wed Mar 23, 2016 1:39 am
Contact:

About Question enthuware.ocajp.i.v8.2.1111 :

Post by Sergio »

boolean b1 = false;
boolean b2 = false;
if (b2=b1==false)

which is the operation that is executed first?

admin
Site Admin
Posts: 10062
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1111 :

Post by admin »

As per https://docs.oracle.com/javase/specs/jl ... l#jls-15.2
assignment operator = has lower precedence than ==. Therefore, the given expression is same as:
b2 = (b1==false)
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

AndaRO
Posts: 31
Joined: Wed Feb 08, 2017 5:42 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1111 :

Post by AndaRO »

[quote="admin"]As per https://docs.oracle.com/javase/specs/jl ... l#jls-15.2
assignment operator = has lower precedence than ==. Therefore, the given expression is same as:
b2 = (b1==false)
(which is the Left Hand Side of the expression), it returns true, which is again a boolean.
[quote]

true is right side of the expression.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 49 guests