Home Help Java R Return Java Keyword



Return Java Keyword
Posted on: November 16, 2009 at 12:00 AM
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()

{

<statements>

return;

}

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;

return(i);

}

Related Tags for Return Java Keyword:


More Tutorials from this section

Ask Questions?    Discuss: Return Java Keyword  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.