Java (both the language and the JVM) are not aware of constants. To reduce confusion it’s better to not use the term “constant” in Java code, unless it’s actually a universal constant. Continue reading “Java knows no Constants”
A language can’t be slow. Or how fast do you think English is?
And modern JVMs are highly optimized. Continue reading “Java is not slow”
Here’s some advice to all who have just begun learning Java. This also serves as an overview to my blog, where I write about all kinds of misconceptions and common problems with programming in Java. Continue reading “Dos and Don’ts”
Some Mammals can fly. Dog extends Mammal, but it can’t fly. The term “extends” leads to some misconceptions. Continue reading “Misconceptions about the “extends” Keyword”
There’s a lot of confusion about “functions” in Java. Java doesn’t really have them, but an object could represent a function so it kind of does have them. I try to explain the different meanings of “functions” in Java, other languages and in mathematics.Continue reading “Functions in Java”
New is used to create new objects. But it’s used carelessly.Continue reading “Misconceptions about the new Operator”
The given implementation for
hashCode is somewhat a mystery. Some misconceptions about it confuse students. I try to explain it. Continue reading “Misconceptions about Object.hashCode()”
Generics have one thing in common with regular expressions: Students think they are an easy to use tool but they just end up with code they do not understand and can’t maintain. Regular expressions can often be replaced by well written and documented code. But you can’t just replace generics. A student using collections with generic type parameters but not fully understanding the concept is still better than one using “raw” collections. And it’s often ok to use something just to get familiar with the idea before learning the theory. The downside is that many misconceptions emerge from this approach of teaching. In this post I try to explain some of the common misconceptions on generics in Java.Continue reading “Generics”
Abstraction is very important in Java. And there’s the keyword abstract. But the use of abstract is not abstraction. It’s a common misconception that the abstract keyword is used for abstraction.
Continue reading “Abstraction vs abstract”
Any book on OOP must explain inheritance, simply because it’s an important part of OOP in many languages. And since it’s so hard to explain and understand a large part of the book will be just about inheritance. This may lead to the false impression that OOP is just about inheritance.