boolean b1 = false;
boolean b2 = false;
if (b2=b1==false)
which is the operation that is executed first?
About Question enthuware.ocajp.i.v8.2.1111 :
Moderator: admin
-
- Posts: 7
- Joined: Wed Mar 23, 2016 1:39 am
- Contact:
-
- Site Admin
- Posts: 10062
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1111 :
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.
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.
-
- Posts: 31
- Joined: Wed Feb 08, 2017 5:42 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1111 :
[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.
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.
Who is online
Users browsing this forum: Bing [Bot] and 49 guests