In Java, the return keyword is used in a method to send a result back to the part of the code that called the method. When you declare a method with a specific return type, like int or String, you must use return to provide a value of that type. For example, in a method public int add(int a, int b), you might write return a + b; to return the sum of a and b. The return keyword stops the method’s execution and provides the specified value back to the caller. Methods with void as a return type don’t use return to provide a value but can use it to exit the method early.
Download
0 formats
No download links available.
Using Return Keyword in Method in Java programming #javaprogramming #tamilexplanation | NatokHD