Function Calling in Java
Here are the implementation of Function Calling in java language:
/*package whatever //do not write package name here */
import java.io.*;
class GFG {
// sum function which takes two parameters and returns
// their sum
public static int sum(int a, int b) { return a + b; }
public static void main(String[] args)
{
int x = 5, y = 10;
// Calling the function sum with x and y as
// arguments
int s = sum(x, y);
System.out.println(x + " + " + y + " = " + s);
}
}
Output
5 + 10 = 15
Function Calling in Programming
Function Calling in programming refers to the process of invoking or executing a function within a program. Functions are blocks of code that perform a specific task, and they allow programmers to organize their code into reusable units, making it easier to manage and maintain.
Table of Content
- What is Function Calling?
- Function Calling in C
- Function Calling in C++
- Function Calling in Java
- Function Calling in Python
- Function Calling in C#
- Function Calling in JavaScript