The parameters define the input value for a method.
The following code defines a method called add, which adds two int type variables together.
add method has two parameters, a and b.
When calling the add method we must provide data for a and b.
using System;
class Program
{
static int add(int a, int b)
{
int result = a + b;
Console.WriteLine(result);
return result;
}
static void Main(string[] args)
{
add(1, 2);
}
}
| ww___w___.__j_a___va___2___s___._c_o___m_ | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |