Results 1 to 7 of 7
  1. #1
    mayankpant is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Post how the flow works. Unable to find the flow of the code also need explanation in case

    public class Plant
    {

    private String name;
    public Plant(String name)

    { this.name = name; }



    public String getName()

    { return name; }

    }


    public class Tree extends Plant {

    public void growFruit() { }

    public void dropLeaves() { }


    }

  2. #2
    jbarke12's Avatar
    jbarke12 is offline Member
    Join Date
    May 2013
    Location
    Charleston, South Carolina USA
    Posts
    88
    Rep Power
    0

    Default Re: how the flow works. Unable to find the flow of the code also need explanation in

    I dont understand what your question is.

  3. #3
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: how the flow works. Unable to find the flow of the code also need explanation in

    if you are on about the order the code is executed, its really impossible to say based on this code alone.

    There is a main method where Java applications are run from, then any method that is called, may also call several methods inside it, which may also call several methods.

    You would need to trace the apllication back from the main method.

    There's a high chance public Plant(String name) is the very first method called

  4. #4
    mayankpant is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Re: how the flow works. Unable to find the flow of the code also need explanation in

    i had few options for the above question:

    Which statement is true?
    A. The code will compile without changes.
    B. The code will compile if public Tree() { Plant(); } is added to the Tree class.
    C. The code will compile if public Plant() { Tree(); } is added to the Plant class.
    D. The code will compile if public Plant() { this("fern"); } is added to the Plant class.
    E. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class

  5. #5
    mayankpant is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Re: how the flow works. Unable to find the flow of the code also need explanation in

    i had few options for the above question:

    Which statement is true?
    A. The code will compile without changes.
    B. The code will compile if public Tree() { Plant(); } is added to the Tree class.
    C. The code will compile if public Plant() { Tree(); } is added to the Plant class.
    D. The code will compile if public Plant() { this("fern"); } is added to the Plant class.
    E. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class

  6. #6
    mayankpant is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Re: how the flow works. Unable to find the flow of the code also need explanation in

    i had few options for the above question:

    Which statement is true?
    A. The code will compile without changes.
    B. The code will compile if public Tree() { Plant(); } is added to the Tree class.
    C. The code will compile if public Plant() { Tree(); } is added to the Plant class.
    D. The code will compile if public Plant() { this("fern"); } is added to the Plant class.
    E. The code will compile if public Plant() { Plant("fern"); } is added to the Plant class

  7. #7
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: how the flow works. Unable to find the flow of the code also need explanation in

    the first one.

    the other 4 are all complete rubbish! (No offense)

    if you wanted to say the plant was a fern:

    Java Code:
    public static void main(String[] args) {
    
    
    Planet p = new Plant("tree"); 
    
    }
    in java you call the methods and pass in parameters if needed

    Please do not spam your thread, it makes you look desperate and people will often ignore your request for help if you start going against forum etiquette

Similar Threads

  1. [ASK]Java Flow Chart to source code
    By potatosaladz in forum New To Java
    Replies: 0
    Last Post: 12-28-2010, 07:11 AM
  2. How to generate Data Flow Diagram(Work Flow Diagram)
    By stsivaraj in forum AWT / Swing
    Replies: 1
    Last Post: 12-23-2010, 12:21 AM
  3. program flow
    By loktamu in forum AWT / Swing
    Replies: 1
    Last Post: 09-17-2008, 05:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •