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 comments

18

u/CaptainKvass Jan 18 '22

var, on the other hand, is not a keyword, but is a reserved type name. So you can use it as an identifier (so "var var = 0" is legal Java). Please don't do this.

I had to try this, and it cracked me up. var var = "var";

0

u/jadecristal Jan 19 '22

Which collapses to var is a String containing “var”, right?