Back to articles
πŸš€ Day 12 of My Automation Journey – Understanding Polymorphism in Java

πŸš€ Day 12 of My Automation Journey – Understanding Polymorphism in Java

via Dev.tobala d kaveri

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

Read Full Article
2 views

Related Articles