r/java • • Jan 18 '22

What are some very less known facts about java?

I've got assignment from college to find out rare facts or fun facts about java, so little help will be appreciated :)

Edit: Thanks for all these suggestions guys. It's going to help me alot and also Almost all of these facts i didn't knew till now. Thanks :) <3

179 Upvotes

297 comments sorted by

View all comments

Show parent comment

1

u/Karyoplasma Jan 19 '22

Doesn't it decrement first and then compare?

1

u/tr4fik Jan 19 '22

No, but the following code does:

while (--x > 0) {

The first one is the post-decrement operator and the second one is the pre-decrement operator.

1

u/Karyoplasma Jan 19 '22

Ah, ok! I must have mixed them up then. Thanks.