Difference between void and return ? Can we have return statement in the void method ?
Questions
Search
List By Company
List By Topic
Legacy
Tests
Repository
DashBoard
Java
Java 8
Java 7
Java Abbreviations
OCJP / SCJP
Class List
New in Java 8
Java Exceptions
Spring Exceptions
Java Enums
Java 8 Lambda
Java 8 java.time
Big Data
Best Of Java
Discussion
Search
Subscribe
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
Search
Submit Question
Interview Questions and Answers
Q1.
Difference between void and return ? Can we have return statement in the void method ?
Core Java
Ans. void is a declaration that states that the method declared void is not expected to return anything.
return is a statement within the method that returns the control out of the method.
Yes, we can have return statement in the void method but without any argument.
Help us improve. Please let us know the company, where you were asked this question
:
Like
Discuss
Correct / Improve
 
Correction
Duplicate of Another Question
Company where this question was Asked
Suggestion
Related Questions
What are the ways to avoid LazyInitializationException ?
Why do we write public static void main ? Can we use some other syntax too for main ?
What is database deadlock ? How can we avoid them?
Which of the following are valid declarations
1. void method(int... x){};
2. void method(int.. x){};
3. void method(int.. .x){};
4. void method(int ...x){};
5. void method(int... x){};
6. void method(int ... x){};
7. void method(int x, int... y){};
8. void method(int... x, int y){};
9. void method(int... x,int... y){};
What is the difference between these two method declarations ?
private static void method(String[] arg)
and
private static void method(String... arg)
Will the static block be executed in the following code ? Why ?
Which of the following is false about Constructors ?
Can we overload method as following ?
void method(int... x){};
void method(int[] x){};
Can we compose the Parent Class object like this ?
How should we ignore or avoid executing set of tests ?
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: