Implicit & Explicit Parameters in Java, Explained

833
0
SHARE

We’ve got the funky names for the things in Java. Implicit and explicit parameters. What the hell is that. As a programmer you’ve probably used them multiple times before without even knowing it. Just the nice guys that made the language decided to give it a name so no-coders would find it difficult to learn; by the looks of things.

But yeah, I’m going to explain simply what an explicit parameter is and what an implicit parameter is.

You can see that I’ve gone the normal course of making a class, a constructor, some methods to get and set, and made a main thingy.

Related:  How to Use Java's Scanner to Read Text Files

So the last significant line of code is setting the exampleThing’s number to 100.

The EXPLICIT PARAMETER is 100. That’s because you are EXPLICITALLY saying the you want to input 100. No doubt’s about that is there?

The IMPLICIT PARAMETER, on the other hand, is the OBJECT you have specified before the setNumber method.

Also, note, “this” (used in the setter and getter methods) is also IMPLICIT. Additionally, the parameter in these methods “number” is EXPLICIT.

That should make your life easier!

Until next time, Josh!