1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Law Incorporation [45]
3 years ago
6

What is Recursion in Java?

Computers and Technology
1 answer:
wel3 years ago
6 0

Answer:

Recursion is a process of defining a method that calls itself repeatedly

Explanation:

Recursion is a basic programming technique of defining a method that calls itself repeatedly.

One practical example is using recursion to find the factorial of a number.

Consider the following java code below, it uses recursion to solve for the factorial of a number.

class Main {

   public static void main (String[] args) {

       System.out.println("Factorial of 3 is " + factorial(3));

       System.out.println("Factorial of 5 is " + factorial(5));

       System.out.println("Factorial of 7 is " + factorial(7));

   }

   //the factorial method uses recursion to find the factorial of the

   // parameter of the integer pass into it

   

   private static int factorial(int n) {

       int result;

       if ( n ==1) return 1;

       result = factorial(n-1) * n;

       return result;

   }

}

You might be interested in
Jeanne writes a song, and Raul wants to perform
Goryan [66]
B) ask jeanne for permission
6 0
3 years ago
Read 2 more answers
Assume the existence of a class named window with functions named close and freeresources, both of which accept no parameters an
denis-greek [22]
In your question whereas there is a class named window and it would be like this:

class window {
//code here 
}

Next is there is a function called close and freeresource and it goes like this:

class window{
  function close( ){
   //code here
  }
  function freeresource( ){
  // code here
  }
 public destruct (){
this.close();
this.freeresource();
}

}
The last code function destruct invokes the function close and freeresource. Hope this would help 

7 0
3 years ago
A red wavy line under a word means _____. a change has been made in the text a new word was inserted in the document there is a
zloy xaker [14]
Hi there!

The correct option is C. <span>there is a spelling mistake. The red wavy line indicates that a word was spelled incorrectly, sometimes though this function does not recognize the word it can mark it as incorrect even when it is not, in which case you can right-click the marked word and add it to your computer's internal word dictionary. Right-clicking an incorrectly spelled word will also give a short list of words that are similar to the one you are trying to spell, clicking on one of the given words will automatically change the marked word to the one you chose.

-Your friend, ASIAX</span>
7 0
3 years ago
Read 2 more answers
There are two kinds of emotions: positive and negative. True False
fgiga [73]

Answer:

False

Explanation:

There are many emotions the human brain can experience

6 0
2 years ago
Read 2 more answers
To move an icon, you right-click it and select “Pin to start menu.” True False
tester [92]

"To move an icon, you right-click it and select “Pin to start menu.” True False"

False

4 0
3 years ago
Read 2 more answers
Other questions:
  • If you are trying to create a web page for your band and having difficulty creating links to other groups on your page, what is
    7·1 answer
  • What acts as a platform on which application software runs?
    8·1 answer
  • In a paragraph of no less than 125 words, describe how technology helps business professionals to be more efficient. Include exa
    12·2 answers
  • Your boss wants to utilize some sort of cloud storage for his files so that all of his
    10·2 answers
  • Write a C function which mimics the behavior of the assembly language function below. Note that this time, the assembly language
    10·1 answer
  • Random Walker Collisions In lecture, we saw how to model the behavior of a random walker on a 2D grid using a Monte Carlo simula
    8·1 answer
  • What is the code for this please?​
    13·1 answer
  • What is the standard unit used to measure mass?​
    9·1 answer
  • Which 1947 Invention paved the way for the Digital Revolution?
    12·2 answers
  • What are the different types of monitors?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!