Answers for "difference between void and non void methods"

1

void vs non void methods

-void : does not return any value. The "void"
return type means that this method doesn't
have a return type.
	In an application, this approach may be used 
    to print runtime specific messages on the console. 
    Exp: "setter" in encapsulation.
	
	-non-void: MUST return a Value.
    (Data type needs to be same with return-type)
	This means that you can use the returned 
    value in your code for further processing.
    I guess good examples of such methods are "getter" in encapsulation.
Posted by: Guest on December-05-2020

Browse Popular Code Answers by Language