Different results can both be correct. This depends on the grammar used to parse the expression. Some handle implied multiplication with higher precedence, others don’t.
There’s this meme on the internet about two calculators (or phone calculator apps) with different results. This is a common misconception and therefore a perfect topic for my blog.
Continue reading “It’s about RTFM, not BOMDAS!”
For beginners it is difficult to understand what a variable is. They are used in nearly all high-level languages and therefore vital for a good understanding of programming
Continue reading “What is a Variable?”
Many misconceptions in Java and similar languages stem from the bad default behaviour. I’ll explain some of them.
Continue reading “Bad Defaults in Java”
Java isn’t easy. It’s often more complex than needed. But being easy for beginners shouldn’t be a design goal with high priority.
Should a programming language be easy?
I don’t know why so many educational establishments use Java to teach programming. They often start with Java in the first semester. Even the Oracle tutorials expect the reader to already know some basics. Java was designed for programmers who already know C/C++ as seen in this example.
Continue reading “Is Java easy?”
main method is similar to the
main function in C and C++; it’s the entry point for your application and will subsequently invoke all the other methods required by your program. [Lesson: A Closer Look at the “Hello World!” Application]
Was 1900 a leap year and does every minute have 60 seconds?
Continue reading “Misconceptions about Dates and Time”
In Java we have a new API for Date and Time since Java SE 8. Before that, there was already an API with mutable dates and fore some reason there was a date just for SQL.
Since many were not happy with it there was Joda-Time, which later became the basis for JSR-310 and is now found in the package “java.time”.
The keyword static is arguably a bad choice or naming.
If you look up “static” in a dictionary you find many meanings, none of which explains its use in programming languages. So why is it used in Java, and how is it misunderstood?
Continue reading “Misnomer: static Keyword”
Why is 0.1+0.2 not equal to 0.3?
The IEEE Standard for Floating-Point Arithmetic is confusing for beginners. Here I try to give an alternative explanation. It’s not my goal to make it easy. It simply isn’t easy. But this might help understand some aspects of floating point arithmetic.
Continue reading “Set-theoretic explanation of IEEE 754”
In my blog I write about misconceptions. Encapsulation is something you learn when you study Java and OOP. But it seems that most books fail to truly explain the problems you want to solve with it and those you get by using it. Often it’s just a short chapter or even just a small part about the important concepts of OOP. This is leading to misconceptions and poor understanding of OOP.
(Note: I wrote this before the release of Java 10. Expect that some things are somewhat outdated.)
Continue reading “Encapsulation”
You may wonder if double checked locking (DCL) works in Java. It does and it doesn’t. I explain why. Continue reading “Double Checked Locking in Java”
So Java has references. But what about pointers and pass-by-reference? References in Java are different to PHP, C# and other languages. And this can cause some confusion. Continue reading “What are References in Java?”