Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:07:51+00:00 2026-06-04T13:07:51+00:00

How is recursion implemented in Java? My question is about what happens behind when

  • 0

How is recursion implemented in Java? My question is about what happens behind when a recusrsive method is executed in Java. I vaguely understand that it uses the Stack, but i am looking for a clear explanation with example.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:07:52+00:00Added an answer on June 4, 2026 at 1:07 pm

    Recursion isn’t handled much differently in Java than in other (imperative) languages.

    There’s a stack which holds a stack frame for every method invocation. That stack is the call stack (or simply just “stack”, when the context makes it clear what is meant). The element on the stack are called “stack frames”.

    A stack frame holds the method arguments passed in and the local variables of a method invocation (and possibly some other data, such as the return address).

    When a method invokes itself (or, in fact, any method) then a new stack frame is created for the parameters and local variables of the newly-called method.

    During the method execution the code can only access the values in the current (i.e. top-most) stack frame.

    This way a single (local) variable can seemingly have many different values at the same time.

    Recursion isn’t handled any other way than normal method calls, except that multiple stack frames will represent invocations of the same method at the same time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recall that one should always avoid using recursive method calls in Java .
Using recursion, find an index that cuts an array in two parts so that
I have a recursion function that parses an object/array with a global variable. If
I know that recursion is sometimes a lot cleaner than looping, and I'm not
I am learning about recursion tree's and trying to figure out how the height
I am currently studying recursion in school, and I have trouble thinking about methods
I've already asked a question about this, yet I'm still confused. I want to
I'm new to Ruby (being a Java dev) and trying to implement a method
I've got a Java client that needs to recursively call a server to retrieve
In Java, I'm trying to retrieve a HashMap<String, Object> that has the Object which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.