Ayush Agarwal
Ayush Agarwal's Blog

Ayush Agarwal's Blog

Return Keyword In Java

Return Keyword In Java

Ayush Agarwal's photo
Ayush Agarwal

Published on Dec 25, 2020

2 min read

Subscribe to my newsletter and never miss my upcoming articles

It's another Friday and a festive one too. So first of all, Merry Christmas to all the readers. Since it's a big festive day, I'll keep this blog a very, very short one.

Yes, as the title goes, it is about the "return" keyword in Java.

What is a return keyword? Return is a unique keyword. When encountered ends the main. That means no statement will be executed after the return statement.

Let's understand it with a simple example:

public static void main(String[] args)
   int a=10;

From the above example, we see that program execution stops at the return statement. And the next print statement, which was supposed to print "Hi," doesn't executes.

So, this was it in this week's blog. Enjoy the festival and see you next Friday.

Share this