Home / Questions / What is a return type in Java methods?
Explanatory Question

What is a return type in Java methods?

👁 4 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

It specifies the type of value returned by the method.


int sum() {
    return 10;
}

Use void if nothing is returned.