Overloading and Overriding in Java

[ad_1]

java overloading overriding
java overloading overriding

Overloading and Overriding in Java – Before getting to know about Overloading and Overriding in Java, it’s good if we know about Java first. Java is a computer programming language that is commonly used to develop the back-end of a website, software or application. Back-end is everything related to servers and databases. While the front-end is everything related to the appearance (images, design, audio, video, etc.) of a website and application.

Java is known as the motto “Write once, run anywhere” which means that every program code in Java can be run on different platforms without rearranging it or we can call it one writing.

Well, now that you know about Java, now we will move on to the next discussion, namely Overloading and Overriding in Java.

What is Overloading and Overriding?

  • Overloading is a way that can create one or more with the same name in a class but with a different number and type of parameters. the example is :
overloading example
overloading example

Those marked with a red box are called by name. Then which part of the image is called the parameter? The parameter part in the above program code is

parameter
parameter

The three parameters above are certainly different, because this is a condition of using overloading, namely the difference in the parameters, whether it’s with a different type, or a different amount.

You need to know that the return value data type is not included in the method overloading distinction. What does it mean? method overloading’s type distinction only applies to those inside the parameter, not outside the parameter.

If the program code you are running does not have an error, then the application of overriding has been successful.

That’s a glimpse of overloading and overriding, thank you for stopping by, hopefully it’s useful and sorry for the wrong words. Good luck, friends



[ad_2]