What is the use of return statement without any argument ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. What is the use of return statement without any argument ?Core Java
Ans. Such return is only expected in methods that returns void. the purpose of having return in such a method is to return the flow out of method and return to the place where it was called. Its actually used to prematurely return the control from the method.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     return


Related Questions

  what is covariant return type?
  Overridden methods must have the same ...
  Which of the following is false about Constructors ?
 What is the difference between these two approaches of creating singleton Class ?

//Double Checked Locking Code
public static Singleton createInstance() {
   if(singleton == null){
      synchronized(Singleton.class) {
         if(singleton == null) {
            singleton = new Singleton();
         }
      }
   }
   return singleton;
}

//Single checked locking code
public static Singleton createInstance() {
   synchronized(Singleton.class) {
      if(singleton == null) {
         singleton = new Singleton();
      }
   }
   return singleton;
}
 Write a method it will return reverse of the string(with out using reverse method of String or StringBuffer)
  Will static block for Test Class execute in the following code ?
  If you have access to a function that returns a random integer from one to five, write another function which returns a random integer from one to seven.
  Why is null == null returns true ?
 Can we have try statement without catch? If try statement contains return will the finally block be executed? What happens if there is an exception inside finally block?
 Does Constructor returns the reference of the newly created object ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: