Different Classifications of Methods
Let's take a look at the different ways to classify methods in Java.
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.
Get hands-on with 1400+ tech skills courses.