Tutorialslot.com

youtube facebook twitter gmail pinterest

Return Statement in Java

It is used to explicitly return from the current method,which means it transfers the control back to the caller of the method.when a return statement is given it immediately terminates the current method in which it is executed.

Example:

public class Return
{

    static int area(int height, int width)
    {
        return height * width;
    }

    public static void main(String[] args)
    {
        int result = area(200,100 );
        System.out.println(result);
    }
}

Output:
20000



Advertisement Powered By Google Adsense






IF YOU LIKE THIS TUTORIALS PLEASE SHARE

Share on whatsapp

POPULAR TAGS

Java java tutorials learn java java programming tutorial learn java online learning java professionals tutorials Multithreading Generics Object Oriented Language Methods Polymorphism Inheritance