Re: Top Ten Errors Java Programmers Make



Additya wrote:
Hello friends , Here is a nice article which I have found while
surfing , it is about the ten common errors which may be made by any
Java Programmer while Programming. The article lists all those
mistakes and their solution.
http://www.ezdia.com/Top_Ten_Errors_Java_Programmers_make/Content.do?id=839

No comment about whether these are or are not truly the
"top ten," except to note that the article makes no mention
of any kind of quantitative survey.

However, the article looks awfully old and some of its
advice is out of date. For example, error #9 (mistyping a
method name -> failure to override) says that the only way to
catch the problem is to notice that your "overriding" method
doesn't actually get called. In modern Java you'd use an
@Override annotation, and the compiler would catch the error.
(Also, examples based on AWT are just a wee bit antiquated.)

Error #6 (pass by reference or by value) has an explanation
that I think just adds to confusion. It seems to me more helpful
to say that Java *always* passes by value, but that some of those
values *are* references. Since he's just made the point about
reference values in error #7 (mixing up == and .equals), it's a
shame he didn't follow through.

--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxxx
.



Relevant Pages

  • Re: How java passes object references?
    ... Which everybody knows, it doesn't in Java. ... The reason I think this is a useful clarification is that when you got to the part about how passing by reference might work, it seems you went off track at least partly because you didn't understand the nature of the above. ... is a pointer pointing at the memory block. ... Assignments to local variables, or even to class members, do not allocate memory. ...
    (comp.lang.java.programmer)
  • Re: call by reference
    ... We started learning Java about one month ago, and they just don't believe me when i try to explain that there is a confusion when passing reference types as an argumetn to a function. ... The actual parameter must be an L-value. ...
    (comp.lang.java.programmer)
  • Re: Argument scope
    ... these would likely be a better fit for Java. ... Java doesn't have pass-by-reference, ... It's a mistake to conflate allocation strategies with ... it does support JBC though, although it is unlikely I will have full J2SE support anytime in the near future. ...
    (comp.lang.java.programmer)
  • Re: The Java no pointer big fat lie!
    ... > reference types, it wouldn't be a good comparison. ... and what you can't - and there is a big difference in Java to C and C++. ... You cannot change it in the language itself, ... Thus I would distinguish pointers from ...
    (comp.lang.java.programmer)
  • Re: programming concepts > specific languages
    ... >actually changes the target of the reference passed to 'function2'. ... Java from a source that was not precise about terminology. ... if I have a class MyObject and write ... I thought primitive types in particular behave in the ...
    (comp.programming)