Different Classifications of Methods
Learn to distinguish various Java method classifications such as void and non-void methods, static versus non-static, public versus private, and method overloading. Understand when and how each type is used, enabling you to write more effective object-oriented code in Java.
We'll cover the following...
We'll cover the following...
Void method vs. non-void method
As we discussed in the last lesson, a method may or may not return a value.
-
A void method is a method that does not return anything. It is declared using the keyword
void. -
A method that returns a value can be classified as a non-void method. The return type for such functions can be primitive or reference type.
-
A void method may or may not use the
return...