Friday, 15 June 2012

java - Netbeans IDE not issuing warnings about methods called in constructors -


It's good to open Netbeans IDE codes that can give you trouble.

  public square base {base (...) {...; Why is not a warning issued?} Public zero foo () {...; }} Public class child base {hair (...) {super (...); Foo (); }}   

Given that I am calling the base class function foo () in the hair constructor? Of course this is completely valid because the base object is created by the point foo (), but a fu () is a virtual method, in fact i expect a warning until foo () is finalized Is not marked .

I think the IDE should issue a warning if you call a child class constructor to a base class function that is not marked as final.

does this.
When you open the file in Netbeans, you should see a yellow lightbulb (hint indicator) next to the call to call foo . It is a suggestion that you either:

  • make the last
  • make foo final, private or static

    if you wish So to be more clear, Tools & gt; Visit Option , or edit> Preferences , or NetBeans & gt; Preferences (depends on your OS). Select editor select sign
    set language to java
    expand Start
    Call the problem in the manufacturer
    as to error
    OK Click

    Now your file will get a red error badge.

    Note, by ignoring any indicators, you will not stop . The code is still valid, so NB will not stop you from compiling.

No comments:

Post a Comment