What is a return type in Java methods?

Short Answer
Views 4

Answer:

It specifies the type of value returned by the method.


int sum() {
    return 10;
}

Use void if nothing is returned.

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Fundamentals: Building Strong Foundations, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.