> For the complete documentation index, see [llms.txt](https://educacion.gitbook.io/programacion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://educacion.gitbook.io/programacion/exercicios-java/ud3-exercicios/recursividade.md).

# Recursividade

1. Crea unha clase recursividade e engade un método suma que reciba por parametro un número n. O método vai devolver a suma dos n primerios números.
2. Crea un método potencia que reciba unha base e un exponente e calcule de forma recursiva a potencia do número
3. Crea un método contaCifras que reciba un número e unha cifra, e devolva o numero de veces que aparece a cifra no número.
4. Crea un método estático denominado invertirPalabra, que recibe un String e devolve o String invertido
5. Crea un método esPalindromo que reciba unha cadena e determine si e ou non é palindromo


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://educacion.gitbook.io/programacion/exercicios-java/ud3-exercicios/recursividade.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
