Share on Google+Share on Google+

Return Java Keyword

The return is a keyword defined in the java programming language.

Return Java Keyword


The return is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java programming language likewise the return keyword indicates the following :  

--  The return keyword is always used with a method only to specify that the method is going to return something.
--  The return keyword forces a method to return to the method calling it.
--  The return keyword passes a value back to the calling method after matching the
return type of the called method.
If there is void return type it means it is returning nothing back to the called function. 
If the method has a non−void return type, the return statement must have an argument of the same or a compatible type.

Using a return Keyword within a class, with a method

A method returning nothing

public void Void_Method()





A method returning a String

public String String_Method()


String s = "its Ridiculous to do such kind of work, people here are just aim less";

return s;


A method returning an Int value 

public int Int_Method()


int i = 5;





Posted on: November 16, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Return Java Keyword  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
August 19, 2011

How to use return in method
September 1, 2011

i have one doubt .. return keyword will print that value?