Function Overloading in JAVA

You can create more than one functions with the same name in a java class if their signatures are different.

Look at the 3 different variants of add() functions in the source code given below.


class fun_Overload
	int add(int a, int b)
		return a+b;
	int add(int a, int b, int c)
		return a+b+c;
	String add(String s1, String s2)
		return s1+s2;
	public static void main(String args[])
		fun_Overload fov=new fun_Overload();
		System.out.println(fov.add("Learn By", " Watch"));

Download “Download Function Overload Source Code” – Downloaded 101 times – 330 B

Vineet Agrawal

An educational consultant Vineet Agrawal is a director and founder of Solution Center, Agra. He has been providing training for last 17 years. He has trained 1000s of students of the software industry. He has been actively involved in final year projects of B.Tech. (CS /IT). The programs included in this video series are based on his experience of teaching that will help you in cracking a java interview.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu


Close Panel
Skip to toolbar