methods and construtors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #16
    Originally posted by pattanaikhr
    Yes that is right java is case sensitive ,

    ok Test(){---------> constructor
    }

    public void Test(){-------->method.

    }

    void Test(){------>
    }
    then how can we differentiate method and constructor
    That's the example I just gave and I did say that you'd then have to check the modifier that was used. e.g if the modifier is public or protected then it's a constructor, if there is no modifier, then it's a constructor again, otherwise it's a method.

    However, to get it to work properly you'd need to parse the program first breaking it up into statements so that you have a statement on each line ...

    Comment

    Working...