Top Ten Errors Java Programmers Make
Join the DZone community and get the full member experience.Join For Free
i read an article (linked below) on “ top ten errors java programmers make “. the author has mentioned the errors which even the most experienced programmers often commit or the new to java programmers may commit in the future. not only has he listed the errors but also given the possible solution for the same. i found the article really informative.
one can read the article here .
i would like to add some more:
a .java source file can contain more than one class but it can contain atmost one top level class (or interface) definition that is public and the name of the source file must be same as that of the public class (or interface).
static methods cannot be overridden but can be hidden if they are not final (read about overriding vs hiding
the objects created in the string pool are not subjected to gc until the class is unloaded by the jvm.
only methods or code blocks can be marked “synchronized”.
local classes cannot access non-final variables.
-0.0 == 0.0 is true.
collection (singular) is an interface, but collections (plural) is a helper class.
continue must be in a loop (e.g., for, do, while). it cannot appear in case constructs.
- instance initializers are executed only if an object is constructed.
Opinions expressed by DZone contributors are their own.