- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do we call a Java method recursively?
Recursion is where which a method class itself.
Example
public class RecursionExample { private static long factorial(int n) { if (n == 1) return 1; else return n * factorial(n-1); } public static void main(String args[]) { RecursionExample obj = new RecursionExample(); long result = obj.factorial(5); System.out.println(result); } }
Advertisements
To Continue Learning Please Login
Login with Google