Welcome To Shadab's Blog

Programming Blog to learn C# , java, Sql Server 2005 and many more things.





About Me

My photo
Bokaro, Jharkhand, India

Friday, March 12, 2010

What is mthod in programming language OR in C# programming language ?

As discuss in previous post that behavior and method are same thing.
                       Now I am going to give a definition of method in programmatically.
Method-> In programming languages set of statementthat is written inside a block {} and used to perform a specific task is callled method.

In other words any task that is performed by object is called method or behaviour of an object .
Suppose you have ability to talk ,write,and move read all these are your behavior.

Now how to write a method in programing language ?
Syntax-

Access-spcifire retrun-type MethodName()
{
            //Set of statement that has a spedific task..
}

Now a short Example ->
public void Add() //this is an Add method
{
     res=num1+num2 //instruction that is written here
}