This Java program defines a class named Example with multiple overloaded print methods, each accepting different types of parameters. Let's break down the code:
class Example { void print() { System.out.println("No Parameter"); } void print(int num) { System.out.println("Integer : " + num); } void print(String message) { System.out.println("String : " + message); } public static void main(String[] args) { Example example = new Example(); example.print(); example.print(67); example.print("Hello World"); } }
No Parameter Integer : 67 String : Hello World
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions