
π Day 12 of My Automation Journey β Understanding Polymorphism in Java
As part of my automation learning journey, today I explored one of the core Object-Oriented Programming (OOP) concepts in Java β Polymorphism. So far, we started with the first type of polymorphism, which is Method Overloading. This concept allows a class to have multiple methods with the same name but different parameters. π What is Polymorphism? Polymorphism means βmany forms.β In Java, polymorphism allows the same method name to behave differently based on the parameters passed. Two types of polymorphism in Java 1οΈβ£ Compile-Time Polymorphism (Method Overloading) 2οΈβ£ Run-Time Polymorphism (Method Overriding) Today we focused on Method Overloading. π What is Method Overloading? Method overloading means: Same method name Different number of arguments Different types of arguments Different order of parameters Example idea: debitamount(int amount, int pin) debitamount(long amount, int pin, String name, double balance) Even though the method name is the same, the parameters are different,
Continue reading on Dev.to
Opens in a new tab



