GoConqr has a new look! Let us know what you think.

Module 6 of 12 · Text

Int Method

Brenda Gabriela Senra da Silva

Se o método declara um tipo de retorno, ele deve devolver:

  • Exatamente aquele tipo
    ou

  • Algo compatível com aquele tipo

O Java obriga isso.

Se não devolver → erro de compilação.

If the method is not void,
Java requires it to return a value of the declared type on every possible execution path.

 

scanner.nextInt() já retorna um int, então você pode usar direto.

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?