Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Location
    India
    Posts
    58
    Rep Power
    0

    Exclamation Recursion Instance Killing

    Solved .....
    Last edited by Vinod Mukundan; 07-23-2010 at 11:22 AM. Reason: Solved

  2. #2
    arun9683 is offline Member
    Join Date
    Jun 2010
    Location
    Bangalore,India
    Posts
    70
    Rep Power
    0

    Default

    When returning a boolean is going to solve the problem why you are telling not to use Boolean?

    is the below code is not going to solve your prob ?

    Java Code:
    int count = 0;
    fun A(){
    fun B();
    ******
    if(count > 0)
        System.out.println("java rocks !!!!!");
    ******
    }
    
    funB () {
    if("Checking some condition") {
    ++count;
    funA():
    }else {
    exit;
    }
    Arun K R,Bangalore,India
    :)

  3. #3
    arun9683 is offline Member
    Join Date
    Jun 2010
    Location
    Bangalore,India
    Posts
    70
    Rep Power
    0

    Default

    Using finally block to kill the instance is gonna help ?
    Arun K R,Bangalore,India
    :)

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,862
    Rep Power
    19

    Default

    There is no such thing (really) as the "previous instance of A()".
    The previous instance of A() is up the call chain, so where you are in the code is already the previous instance of A(). (Instance is a poor choice of term here, because that is used to mean an instance of a clas in Java).

    So if killing off the previous instance (if that were possible, or even made sense) would actually result you're current bit of execution being killed off. A bit like cutting off the rope you are hanging off, several feet above your head.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,862
    Rep Power
    19

    Default

    There is no such thing as "initialization of the function".
    It's meaningless.

    Without knowing what the problem is that you think this is solving, it's rather difficult to actually help. Because whatever it is you're trying makes no sense with how Java (and most code) works.

    The only way you can prevent A() from calling B() if it is B() that called A() is to use a flag as shown above by arun, that is set in B().

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,862
    Rep Power
    19

Similar Threads

  1. Find instance that owns instance?
    By Addez in forum New To Java
    Replies: 2
    Last Post: 04-04-2010, 03:36 PM
  2. Replies: 22
    Last Post: 09-06-2009, 05:21 PM
  3. killing a java process
    By paritoshcg in forum Advanced Java
    Replies: 3
    Last Post: 12-01-2008, 08:16 AM
  4. Killing an Ill-behaved Thread
    By John6715 in forum Threads and Synchronization
    Replies: 6
    Last Post: 10-03-2008, 08:35 AM
  5. Thread killing
    By denis in forum Threads and Synchronization
    Replies: 13
    Last Post: 09-25-2008, 09:28 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
  •