Puzzling Java statement of the day

Some days ago I stumbled across a Java statement which I thought was trivial at first, only to discover that I had no idea. I have a reasonable understanding of what a JVM does and how Java bytecode is executed. But as this example shows once again, that doesn’t necessarily spread to the Java programming language. The snippet below should explain my point.

int lorem = 1, ipsum = 2, dolor = 3;
if (lorem == (lorem = ipsum))
	f();
if ((ipsum = dolor) == ipsum)
	g();

Which of the above two methods f() and g() is actually invoked? Can you tell without compiling the code? Possible answers are:

  • None of the two methods get invoked, both call-sites are dead code.
  • Just f() is invoked and the call-site of g() is dead code.
  • Just g() is invoked and the call-site of f() is dead code.
  • Both methods are invoked, the conditions are pointless.

Ironically, I finally understood what was going on after looking at the generated bytecode (good old javap is your friend). I am not posting the disassembled code because that would spoil the fun. But once you look at it, the answer appears to be quite obvious.

Excellent blog you have got

Excellent blog you have got here.. It's difficult to find quality writing like yours nowadays.
I seriously appreciate people like you! Take care!!
http://Hidden-Canyon.1103110.N5.Nabble.com/The-Top-10-Sports-Jerseys-Of-... http://www.marbiko.pl/id-3026681065 http://www.veedelplus.de/remember-forever-the-big-game-for-2011-nba-all-...

I'm going to begin following

I'm going to begin following you on Facebook.

Remarkable! Its actually

wonderful issues altogether,

wonderful issues altogether, you simply won a new reader.
What could you recommend in regards to your publish
that you just made a few days in the past? Any certain? http://www.nationalcanine.com/forum/topic/m60-close-up-following-fender-... http://Www.colegiofatima.edu.ni/index.php?option=com_kunena&func=view&ca... http://metal-slug-defense-forums.1126147.N5.nabble.com/usually-requires-...

Marvelous, what a weblog it

Thanks designed for sharing

Thanks designed for sharing such a pleasant thought, piece of writing is fastidious, thats why i have read it fully http://newyorkislandersjerseys.mee.nu/?entry=2694977 http://blazedesk.nl/2010-baseball-all-star-game-fan-review/ http://tollardroyal.com/types-of-basketball-jerseys/

Eclipse spoiled the fun for

Eclipse spoiled the fun for me, since it highlights comparisons between equal expressions (since Galileo I believe), and yes, the Eclipse code analyser gets this right. My first guess when reading the post was right, but I wouldn't have put money on it.

Here's the relevant JLS section: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#1...

This is very interesting, You

This is very interesting, You are an overly professional blogger.

I've joined your feed and look forward to looking for extra of your fantastic post.

Also, I have shared your site in my social networks https://drive.google.com/file/d/1NVBYp0U3wLMC6OaClx-xepDpovSF5EOk/view?u... https://drive.google.com/file/d/17gejt5c2F9A7pU3yd_TSN7bcuCVoc6jz/view?u... https://drive.google.com/file/d/14M2u-aHM-s60z3avec1TZMor6tYNFzp6/view?u...

I do not even know how I

I do not even know how I ended up right here, but I assumed this submit
was once great. I do not understand who you might be but definitely
you're going to a famous blogger when you aren't already.

Cheers! https://www.koreanbbqshop.com/custom-design-team-uniforms-for-an-look/ http://maximum-mini-forum.2322815.n4.nabble.com/mirielle-Dicksusing-s-am... http://Notre-Dame-Girls-School.79155.X6.Nabble.com/Kokomo-partner-trying...

Excellent way of telling, and

Excellent way of telling, and pleasant paragraph to take information concerning my presentation subject matter, which i am going to present in college.

http://blue-knights-colorado-1.40445.n7.nabble.com/Meth-driven-crisp-inc... https://www.brightensomeonesday.net/MAP/event/30160 http://left-bank-manc.2340364.n4.nabble.com/move-on-ski-transfer-pads-th...

An outstanding share! I've

An outstanding share! I've just forwarded this onto a coworker who was doing a little homework on this.
And he actually ordered me breakfast simply because I
discovered it for him... lol. So allow me to reword this....
Thanks for the meal!! But yeah, thanx for spending
some time to talk about this matter here on your web page.
http://aandetoys.com/2016/05/4u3ob43bsb17.html http://www.ddcarton.com/buying-an-additional-soccer-jerseys-as-a-variety... https://cobe.vn/types-of-basketball-jerseys.html

Hello, its pleasant paragraph

Do you have any video of

Do you have any video of that? I'd want to
find out some additional information.wholesale football jerseyshttp://premium.premium27.ru/index.php/kunena/razdel-predlozhenij/106-excited-tabbies-keep-tight-duty-on-up-against-parthttp://www.nadpiramida.ru/forum/viewtopic.php?f=1&t=42389

I was recommended this web

I was recommended this web site via my cousin. I am now not certain whether or
not this publish is written by means of him as no one
else understand such targeted approximately my problem.
You are incredible! Thanks! http://www.planetadamusica.com/indicacao/revealing-vital-elements-of-che... http://neworleanspelicansjerseys.spruz.com/pt/2-million-rifle-scale-crea... http://Utim.fr/blog/popularity-of-soccer-jerseys/

It's going to be end of mine

It's going to be end of mine day, however before ending I am reading this wonderful post to increase my experience.authentic football jerseyshttp://michaeltoy.webcrow.jp/viewthread.php?tid=951570&extra=page%3D1&frombbs=1http://rekar.biz/edmontonforum/viewtopic.php?f=19&t=83145

I used to be suggested this

I used to be suggested this web site by means of my cousin.
I'm now not positive whether this submit is written by him as nobody else recognize such specific approximately my problem.
You are wonderful! Thank you! http://www.16leaves.com/top-five-most-terrible-nfl-jerseys/ https://wna.ch/puppy-coaching-teaching-cheap-nfl-jerseys-your-dog-to-acc... http://quin.space/uncategorized/rss-feeds-feed-your-world-wide-web-rrnte...

If you want to obtain much

My brother suggested I may

My brother suggested I may like this web site.
He was totally right. This post truly made my day.
You can not imagine simply how so much time I had
spent for this information! Thanks! http://jerseysanaheimducks.spruz.com/pt/-heroAshtone-Morgan-scored-that-... http://www.todogeologia.com/viewtopic.php?f=2&t=70248 http://Deensidewheelers.com/component/kunena/4-adverts/298381-the-first-...

Quite interesting article,

Quite interesting article, how is your script can help me with the integration payment system in the website with music events http://bandstours.com ? But big thanks for your work! What if I can answer you on this?

Good web site you have here..

Good web site you have here.. It's hard to find
high quality writing like yours nowadays. I honestly appreciate people like you!
Take care!!690090https://www.retrogamersclub.com/forums/topic/tonyan-getting-enhancement-in-search-of-football-aspiration/https://rescuetraining.de/index.php?title=Benutzer_Diskussion:Baidai8300https://www.retrogamersclub.com/forums/topic/tony-romo-playing-pga-concert-tours-race-in-dominican-rebublic-republic/

It's difficult to find

It's difficult to find educated people about this subject,
but you sound like you know what you're talking about!
Thanksauthentic football jerseys Chinahttp://local-723-members.88536.x6.nabble.com/Lyft-voyages-paying-region-td141.htmlhttp://joinbuy.mee.nu/?entry=2793141

Hi there, this weekend is

Hi there, this weekend is good for me, because this occasion i am reading this enormous
informative post here at my house. http://kingdomjersey.mee.nu/?entry=2798670 http://Gayonnet.com/forum/topic/521 http://being-in-the-world.91626.n3.nabble.com/united-kingdom-internation...

Hello, i believe that i

Hello, i believe that i noticed you visited my web site thus i got here to
go back the want?.I am attempting to to find issues to improve my website!I assume its ok to make use of
a few of your ideas!!post-39464http://www.aapaurary.com/forum/AAP_AUR_ARY_postsm5830_Carolina-Panthers-2017.aspxhttp://baidai8300.unblog.fr/2018/08/23/chronicle-the-actual-buffalo-grass-billing-accounts-cycling-cycling-tops/

As the admin of this web page

As the admin of this web page is working, no doubt very
shortly it will be renowned, due to its feature contents.2100http://ridgedroofing.com/index.php?option=com_kunena&view=topic&catid=2&id=135960&Itemid=818http://whotheweio.mee.nu/?entry=2804724

Definitely believe that that

Definitely believe that that you stated. Your favourite justification appeared to be at the net the easiest factor to be aware of.
I say to you, I definitely get irked while other folks
think about concerns that they just don't understand about.
You controlled to hit the nail upon the highest and also outlined
out the entire thing with no need side-effects , folks could
take a signal. Will probably be back to get more. Thanks http://www.forumlogopedyczne.pl/viewtopic.php?f=16&t=186591 http://maximum-mini-forum.2322815.n4.nabble.com/nfl-in-the-media-td558.html http://the-teacher-forum.86415.x6.nabble.com/Socceroos-inform-Bert-van-M...

com which is giving a FREE e

com which is giving a FREE e - Book to helpp get you started with your own survival
garden. Such featurfes aree all benefits of using laptop bags.
You buy one bag but actually with two different shapes.

I'm no longer certain where

I'm no longer certain where you are getting your info, but good topic.
I must spend some time finding out more or figuring out more.
Thank you for fantastic info I was on the lookout
for this info for my mission. http://www.konsciouscreations.com/201702/b04v2duxhy12 http://99jerseys.mee.nu/cheap_jerseysauthentic_pittsburgh_steelers_jerse... http://crazytennisbitches.com/guide-to-sports-activities-jerseys-cheap/

Wonderful goods from you,

Wonderful goods from you, man. I've take into accout your stuff previous to and you are
just too magnificent. I actually like what
you have bought right here, really like what you are stating and the best way in which you say it.
You're making it entertaining and you continue to take care of to keep
it sensible. I can not wait to read much more from you.
That is actually a wonderful web site.

Pingback

[...] Puzzling Java statement of the day | antforge.org antforge.org/blog/2010/07/30/puzzling-java-statement – view page – cached Some days ago I stumbled across a Java statement which I thought was trivial at first, only to discover that I had no idea. I have a reasonable understanding of what a JVM does and how Java bytecode is executed. But as this example shows once again, that doesn’t necessarily spread to the Java programming language. The snippet below should explain my point. Tweets about this link [...]

Howdy very nice web site!!

Howdy very nice web site!! Man .. Beautiful ..

Superb .. I will bookmark your website and take
the feeds also? I'm happy to find a lot of helpful info right here in the post, we'd
like work out extra techniques in this regard,
thanks for sharing. . . . . . https://drive.google.com/file/d/17eB5IfEHaa_bx79eGIgH0TbTjF9Vx32a/view?u... https://drive.google.com/file/d/1PQxxJPr0e0nNmhMbr0D0JGFiCCWf9Tpg/view?u... https://drive.google.com/file/d/1O0G8K2jltdBc5imTZi_ZoW-EP4BMX9-w/view?u...

I think you need help from

I think you need help from this guys http://ezcollegepapers.com , they can help you to beat your papers in college!

If you would like to obtain a

If you would like to obtain a good deal from this post then you
have to apply these techniques to your won web site.
http://www.chrlice.brno.cz/forum/viewtopic.php?f=8&t=57627 http://authentic-cheap-jerseys.mee.nu/?entry=2767440 http://minnesotawildjerseys.mee.nu/?entry=2766448

My brother recommended I

My brother recommended I might like this blog.
He was once entirely right. This put up actually made my
day. You cann't imagine just how a lot time I had spent for this info!
Thanks! http://johanna-maria.82413.x6.nabble.com/Democratic-senators-in-cheap-im... http://premium.Premium27.ru/index.php/kunena/dobro-pozhalovat/46-moose-c... http://lierseontour.bbforum.be/post4862.html

I like reading through a post

Nice post. I used to be

Nice post. I used to be checking constantly this weblog and I am impressed!
Extremely useful info particularly the remaining phase :) I handle such info a lot.
I used to be seeking this certain info for a long time.
Thanks and best of luck. http://traktorbetten.de/2597-2/ http://atlantabravesjerseys.Mee.nu/?entry=2770843 http://www.coolkidsbedding.com/482-2/

It's always cool to see ideas

It's always cool to see ideas people come up with
for kids.

Magnificent goods from you,

Magnificent goods from you, man. I've take into accout your
stuff prior to and you are just extremely great. I actually like what you have got here, really like what you're stating and
the way in which by which you say it. You make it entertaining and you still care
for to keep it sensible. I can not wait to read much more from you.
That is really a terrific website.discount baseball jerseyshttps://www.glamourperfection.com/forum/viewtopic.php?f=18&t=136721http://upto.7227.n7.nabble.com/facets-evacuation-tuesday-td249.html

I used to be recommended this

I used to be recommended this blog through my cousin. I'm
now not positive whether this submit is written via him as no one
else realize such exact about my trouble. You're wonderful!
Thank you! http://clevelandbrownsjerseys.mihanblog.com/post/17 http://jerseysarizonacardinals.spruz.com/pt/2-expired-using-consignments... http://Cheapjerseysgo.mee.nu/?entry=2679628

I do trust all the ideas

I do trust all the ideas you've offered in your post. They're very convincing and will definitely work.
Still, the posts are too short for novices.

May you please lengthen them a bit from next time? Thanks for the post.
http://brooklynnetsjerseys.bcz.com/2018/01/28/and-moreover-ticklers/ http://iacdl-news.85859.x6.nabble.com/Area-performer-purchase-notorious-... http://wholesalejerseys4sale.mee.nu/?entry=2685407

I blog often and I truly

I blog often and I truly thank you for your content. This great article has truly peaked
my interest. I'm going to bookmark your website and
keep checking for new information about once per week.
I subscribed to your Feed too. http://www.wajieibrahim.com.my/2014/05/09/feel-the-rush-and-excitment-of... http://jerseysanaheimducks.mihanblog.com/post/27 http://xcheapjerseys.mee.nu/?entry=2679792

Thank you for every other

Thank you for every other informative blog. The place else
could I am getting that type of info written in such an ideal way?
I have a mission that I'm just now working on, and I have been on the glance out
for such info. http://steffy.ro/forum?func=view&catid=3&id=35025 http://multie.mx/united-s-new-jerseys-number/ http://vipjerseysale.Mihanblog.com/post/14

Hi everyone, it's my first

Hi everyone, it's my first pay a visit at this web page, and
paragraph is really fruitful designed for me, keep up posting such articles.wholesale
nhl jerseyshttps://songexclusive.com/2015/02/20/video-tbt-sports-talk-january-31-2011/https://www.wearabletechnology.london/what-s-happened-in-mlb-on-transport/

What i don't realize is in

What i don't realize is in truth how you are no longer actually a lot more smartly-preferred than you might be now.
You are very intelligent. You already know thus significantly in terms of this
subject, made me in my opinion consider it from so many varied angles.
Its like men and women don't seem to be interested unless it is
something to accomplish with Woman gaga! Your own stuffs
outstanding. All the time care for it up!cheap baseball jerseys from Chinahttp://xn--b1aojbfbabpdgmsl.xn--p1ai/forums/topic/state-of-az-cardinals-search-for-first-football-customer-discipline/http://www.tchoukball.it/forum/viewtopic.php?f=4&t=144390