w3resource ([Link]
php)
Home (/[Link])
▼Java Exercises
Home (/java-
exercises/[Link])
Basic Part-I (/java-
exercises/basic/[Link]
Basic Part-II (/java-
exercises/basic/[Link]
Data Types (/java-
exercises/datatypes/index
Conditional Statement
(/java-
exercises/conditional-
statement/[Link])
Recursive Methods
(/java-
exercises/recursive/index
Java Enum Types (/java-
exercises/java-enum-
[Link])
Exception Handling
(/java-
exercises/exception/index
Array (/java-
exercises/array/[Link]
Java Inheritance (/java-
exercises/index-
[Link])
Java Abstract Classes
(/java-exercises/index-
[Link])
Java Thread (/java-
exercises/thread/[Link]
Java Multithreading
(/java-
exercises/multithreading/
Java Lambda
expression (/java-
exercises/lambda/index.p
Java Generic Method
(/java-
exercises/generic/index.p
Unit Test (/java-
exercises/unittest/index.p
Object-Oriented
Programming (/java-
exercises/oop/[Link])
Java Interface (/java-
exercises/index-
[Link])
Java Encapsulation
(/java-
exercises/encapsulation/i
Java Polymorphism
(/java-exercises/index-
[Link])
Stack (/java-
exercises/stack/[Link]
String (/java-
exercises/string/[Link]
Streams (/java-
exercises/stream/index.p
Date Time (/java-
exercises/datetime/index
Method (/java-
exercises/method/index.p
Numbers (/java-
exercises/numbers/index
File Input-Output (/java-
exercises/io/[Link])
Collection (/java-
exercises/collection/index
Math (/java-
exercises/math/[Link]
Sorting (/java-
exercises/sorting/[Link]
Search (/java-
exercises/search/[Link]
Regular Expression
(/java-
exercises/re/[Link])
▼JavaFx Exercises
JavaFx Exercises Home
(/java-
exercises/javafx/[Link]
..More to come.. ()
Java Recursive Methods: Exercises,
Practice, Solution
Last update on July 16 2023 16:13:51 (UTC/GMT +8 hours)
Java Recursive Exercises [15 exercises with solution]
[An editor is available at the bottom of the page to write and execute the
scripts. Go to the editor]
1. Write a Java recursive method to calculate the factorial of a given positive
integer.
Click me to see the solution ([Link]
exercises/recursive/[Link])
2. Write a Java recursive method to calculate the sum of all numbers from 1 to
n.
Click me to see the solution ([Link]
exercises/recursive/[Link])
3. Write a Java recursive method to calculate the nth Fibonacci number.
Click me to see the solution ([Link]
exercises/recursive/[Link])
4. Write a Java recursive method to check if a given string is a palindrome.
Click me to see the solution ([Link]
exercises/recursive/[Link])
5. Write a Java recursive method to calculate the exponentiation of a number
(base) raised to a power (exponent).
Click me to see the solution ([Link]
exercises/recursive/[Link])
6. Write a Java recursive method to reverse a given string.
Click me to see the solution ([Link]
exercises/recursive/[Link])
7. Write a Java recursive method to find the greatest common divisor (GCD) of
two numbers.
Click me to see the solution ([Link]
exercises/recursive/[Link])
8. Write a Java recursive method to count the number of occurrences of a
specific element in an array.
Click me to see the solution ([Link]
exercises/recursive/[Link])
9. Write a Java recursive method to find the sum of all odd numbers in an array.
Click me to see the solution ([Link]
exercises/recursive/[Link])
10. Write a Java recursive method to find the length of a given string.
Click me to see the solution ([Link]
exercises/recursive/[Link])
11. Write a Java recursive method to generate all possible permutations of a
given string.
Click me to see the solution ([Link]
exercises/recursive/[Link])
12. Write a Java recursive method to find the maximum element in an array.
Click me to see the solution ([Link]
exercises/recursive/[Link])
13. Write a Java recursive method to calculate the product of all numbers in an
array.
Click me to see the solution ([Link]
exercises/recursive/[Link])
14. Write a Java recursive method to find the sum of the digits of a given
integer.
Click me to see the solution ([Link]
exercises/recursive/[Link])
15. Write a Java recursive method to check if a given array is sorted in
ascending order.
Click me to see the solution ([Link]
exercises/recursive/[Link])
More to Come !
* To run the code mouse over on Result panel and click on 'RERUN' button.*
Java Code Editor
Code Run Share
Java beta
[Link]
Choose File No file chosen Remix
Do not submit any solution of the above exercises at here, if you want to
contribute go to the appropriate exercise page.
Follow us on Facebook ([Link]
103553425799800) and Twitter ([Link] for latest
update.
Weekly Trends
Mastering NumPy: 100 Exercises with solutions
([Link]
exercises/numpy/numpy_100_exercises_with_solutions.php)
SQL Tutorial ([Link]
SQL Inner Join ([Link]
Python Exercises, Practice, Solution ([Link]
exercises/)
Python Interview Questions and Answers: Comprehensive Guide
([Link]
Scala Exercises, Practice, Solution ([Link]
exercises/[Link])
Kotlin Exercises practice with solution ([Link]
exercises/[Link])
MongoDB Exercises, Practice, Solution ([Link]
exercises/[Link])
SQL Exercises, Practice, Solution - JOINS ([Link]
exercises/[Link])
Java Basic Programming Exercises ([Link]
exercises/basic/[Link])
SQL Subqueries ([Link]
[Link])
C# Sharp Basic Exercises ([Link]
exercises/basic/[Link])
SQL COUNT() with distinct ([Link]
functions/[Link])
JavaScript HTML Form Validation
([Link]
Java Collection Exercises ([Link]
exercises/collection/[Link])
0 Comments
1 Login
G Start the discussion…
LOG IN WITH OR SIGN UP WITH DISQUS ?
Name
Share Best Newest Oldest
Be the first to comment.
Subscribe Privacy Do Not Sell My Data
This work is licensed under a Creative Commons Attribution 4.0 International License.
([Link]
©[Link] 2011-2024
Privacy ([Link] About ([Link]
Contact ([Link]
Feedback ([Link]
Advertise ([Link]