Depth of Inheritance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrisjohn2009
    New Member
    • Jun 2009
    • 14

    Depth of Inheritance

    I need a java program to find the Depth of Inheritance of a java program source code is given as input file :)
    Can any1 help me out with this
    If so:) Thanks in Advance for Helping
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by chrisjohn2009
    I need a java program to find the Depth of Inheritance of a java program source code is given as input file :)
    Can any1 help me out with this
    If so:) Thanks in Advance for Helping
    Are you talking about level of inheritance?
    Then no need to have the source file, instead you need Class files of all the dependent classes.
    Now have a look at Class.
    Then look at Class.getSuperC lass.

    Comment

    • chrisjohn2009
      New Member
      • Jun 2009
      • 14

      #3
      Sir,
      could u help me out by explaining me a little bit in detail pl...

      Comment

      • chrisjohn2009
        New Member
        • Jun 2009
        • 14

        #4
        Sir,
        i'm doing a Phd work on quality metrics . So basically i'm developing a tool for just checking out the number of classes,element s,inheritances & level of inheritance in a given source code like of morilla firefox ,rhino...

        could me help me out with this sir... pl
        Thanks in Advance for reply....& Guidance

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by chrisjohn2009
          Sir,
          could u help me out by explaining me a little bit in detail pl...
          Have you read the API documentation for the Class class? Have a look at the very first article in this group; it contains a link to the API download site (from Sun). Download the API documentation and read it.

          kind regards,

          Jos

          Comment

          • chrisjohn2009
            New Member
            • Jun 2009
            • 14

            #6
            Thank you sir :)
            i will read the documentation and if there is any sort of doubt i ll ask you sir...
            Thank you for ur guidence sir :)


            with Regards,
            john

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by chrisjohn2009
              Thank you sir :)
              i will read the documentation and if there is any sort of doubt i ll ask you sir...
              Thank you for ur guidence sir :)


              with Regards,
              john
              You're welcome of course; that API documentation is a must read and you should have it stored on your hard drive; without it you're in the dark. Look at the Object class first; it's the 'mother of all classes'. It has a getClass() method that gives you a Class object; it describes the class the particular object is instantiated from. Next look at the API documentation for the Class class; it can return another Class object that represents the super class of the current class if any; otherwise it returns null. That is the building block for what you want to calculate.

              kind regards,

              Jos

              Comment

              • chrisjohn2009
                New Member
                • Jun 2009
                • 14

                #8
                Thank you sir :)
                i will concentrate on it

                Comment

                • chrisjohn2009
                  New Member
                  • Jun 2009
                  • 14

                  #9
                  i need to find the number of files & folders available in a particular folder...
                  i need to develop a program using java...
                  can any1 help me out with this using some code... pl
                  thanks for ur help in advance..

                  In regards,
                  john

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by chrisjohn2009
                    i need to find the number of files & folders available in a particular folder...
                    i need to develop a program using java...
                    can any1 help me out with this using some code... pl
                    thanks for ur help in advance..
                    There's hardly any code to write because the File class does about all; have a look at the list() or listFiles() methods in that class.

                    kind regards,

                    Jos

                    Comment

                    • dmjpro
                      Top Contributor
                      • Jan 2007
                      • 2476

                      #11
                      Originally posted by chrisjohn2009
                      i need to find the number of files & folders available in a particular folder...
                      i need to develop a program using java...
                      can any1 help me out with this using some code... pl
                      thanks for ur help in advance..

                      In regards,
                      john
                      First of all this is a different question, no relation with this thread.
                      Anyway for your solution, see File.listFiles.

                      Comment

                      • chrisjohn2009
                        New Member
                        • Jun 2009
                        • 14

                        #12
                        Command Line Arguments

                        Why do programmers are not comfortable with command line arguments or y they dont opt this techinique???

                        Comment

                        • JosAH
                          Recognized Expert MVP
                          • Mar 2007
                          • 11453

                          #13
                          Originally posted by chrisjohn2009
                          Why do programmers are not comfortable with command line arguments or y they dont opt this techinique???
                          Programmers who aren't comfortable with shells etc. are just junior programmers, too much influenced by a windows, graphical environment. Granted, the shell/cmd in Microsoft Windows isn't worth much but still ...

                          kind regards,

                          Jos

                          Comment

                          • chrisjohn2009
                            New Member
                            • Jun 2009
                            • 14

                            #14
                            Thanks sir :)

                            Kind Regards,
                            john

                            Comment

                            • chrisjohn2009
                              New Member
                              • Jun 2009
                              • 14

                              #15
                              Code:
                              public class ListFilesSubs {
                              
                              
                                  private static void doSimpleFileListing(String dirName) {
                              
                                      System.out.println();
                                      System.out.println("Simple file listing...");
                                      System.out.println("----------------------");
                              
                                      File dir = new File(dirName);
                                      
                                      String[] children = dir.list();
                              
                                      printFiles(children, dirName);
                              
                                  }
                              This is a sample code taken from the internet .
                              Could you help me with this. i get an error as
                              Error with new_dir
                              Either directory does not exist or is not a directory
                              i need to run this program .Pl do help me with this.
                              Thanks for ur help in advance :)

                              Kind Regards,
                              john
                              Last edited by JosAH; Jul 22 '09, 06:03 AM. Reason: added [code] ... [/code] tags

                              Comment

                              Working...