Header Ads

Header Ads

How to create a method

How to create a method and declare a method ..

A method is a collections of statements
To use method you following two steps
1) Define Method
2)Calling Method

Structure of create a method 

< Accesses specifier> <return type> <method name> (parameter list)
{
//statements
}

example how to create a method

public void akash()
{

How to call a  method

//statements
}

public  static void Main(string[]args) 

{
class name cs=new classname();
cs.methodname();
}

example how to call a method 

public static void Main(string[]args)
{
  program p=new program();
p.akash();
}

No comments:

Powered by Blogger.