Java Puzzle 3

Java Puzzle 3

Before I go for weekend, I want to leave my LinkedIn friends with a fun Java code snippet. This time I am gonna do something different.

Can you guess what the code snippet below does?

No alt text provided for this image


Oh no! Really? You call this a puzzle? This is easy bro. This code will print the value of variable f starting from 123456789 , decrementing it by 1 in each iteration until it reaches 0 and then the loop will exit. It will print 123456789,123456788,123456787....1 and 0. This is clearly not a puzzle!!

Okay my dear friend, please pause the article for a moment, run this code on your machine and observe the output. What is the output?

"This can't be true". I can't believe my eyes!

I will explain the output next week. Have a wonderful weekend dear friend. Please leave a comment explaining the output, what this code is testing.

Also, note that I have put together series of Java content to share my experience on Java Oracle certification and advanced topics on Java from my channel. Please be kind to subscribe. The link is below: Thank you in advance

要查看或添加评论,请登录

社区洞察

其他会员也浏览了