+ 1

What is the difference between return statement and print statement

Return vs System.out.print() What makes it different from.each other

23rd May 2019, 12:12 PM
Ayush Pandey
Ayush Pandey - avatar
4 Answers
+ 6
The print statment prints somthing to console window so you can see it like "hello world", The return statment returns somthing back to were the method was called basicly you create a method that does somthing when you pass in some values, the method will do somthing with these and return the outcome back to were the method was called.
23rd May 2019, 12:22 PM
D_Stark
D_Stark - avatar
+ 2
In a void method you can also use just return: You don't return a value but you jump back to the code where the method was called. Using "return" in your main method: end program
23rd May 2019, 10:52 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Will the return value be printed.
23rd May 2019, 12:44 PM
Ayush Pandey
Ayush Pandey - avatar