class Test { void show() { System.out.println("JAVA means SILAN Technology"); } void show(int x) { System.out.println("x=" + x); } void show(double p, double q) { System.out.println(p + " " + q); } class OverloadingExample1 { public static void main(String[] args) { Test t = new Test(); t.show(); t.show(100); t.show(5.2, 4.6); } }
Output:
<
OverloadingExample2.java
class AreaExamples { void area(int length, int breadth) { int a; a = length * breadth; System.out.println("area of rectangle is" + a); } void area(double base, double height) { double ar; ar = 0.5 * base * height; System.out.println("area of triangle is" + ar); } void area(double r) { double arr; arr = 3.141 * r * r; System.out.println("area of circle is" + arr); } class OverloadingExample2{ public static void main(String[] args) { AreaExamples ob=new AreaExamples(); ob.area(5,6); ob.area(2.5,3.4); ob.area(4.6); } }
Output:
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc