Wednesday, 28 August 2013

Method/Function in JAVA

What is Function in Programming??

If someone ask you to write same 10 line like

This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.
This is a Java Programming Tutorial and you get great concept from here.


Then your feeling become bored ,but just imagine what is your feeling when you just call a single method to perform
all above work.That is a Function that make programming easier and reduce complexity.Similarly you see in MATHEMATICS there are function which give some output with each input.

Now come on actual defination of function/method

"Function is a Collection of statement that perform an task".
Example
System.out.println() is a method : use to output the screen at console


Syntax



accessModifer returntype functionName(Parameter)
{
function body
}

Example
public void show()
{
System.out.println("This is a Java Programming Tutorial and you get great concept from here.");
}

No comments:

Post a Comment