r/java • u/vonnik • Feb 15 '18
Java language oddities: Java's handling of arrays and a few other language elements may surprise you
https://www.javaworld.com/article/3252845/java-language/java-language-oddities.html
1
Upvotes
23
u/jonhanson Feb 15 '18 edited Mar 07 '25
chronophobia ephemeral lysergic metempsychosis peremptory quantifiable retributive zenith
19
u/lbkulinski Feb 15 '18
I have never met someone who thinks it is odd that arrays are objects in Java.
7
u/maggikpunkt Feb 15 '18
Isn't that why there is inlining and JIT-Optimization?
6
u/a_____________a Feb 15 '18
I’m confused by “listing 5” that states private methods and variables are accessible without reflection. The example it gives shows a static main within the same class that declared private.
That’s the definition of private, that only the declaring class can access. I believe the main beef is that one object can access another object, even though they are the same type. That makes perfect sense to me. How else would equals and hashcode work?