Function is a small job program.
Functions are basically of two types -
1. Intransic function(Library function)-
Built-in function.
2. Extransic function(global function)
Defined by the user.
FUNCTION DEFINITION-
function_type function_name (parameters with data type)
{
//Statements
}
Ex-
void ftion(int a, int b)
{
int c;
c= a+b;
System.out.println("the sum is " +c);
}
FUNCTION CALLING-
function_name (parameters);
Ex-
ftion(10, 20);
NOTE-
For calling a function, we need to create an object inside the main function
Class_name <Object_name> = new Class_name();
How to call a function-
<Object_name> . function_name();
Comments
Post a Comment