What is the static keyword ?

Total Post:7

Points:49

C#
 255  View(s)
Ratings:
Rate this:

What is the static keyword ?

  1. Re: What is the static keyword ?

    Definition:- A static is a keyword or a modifier. The static keyword can be used with a class, field, method, property, operator, events or constructor without any instance or object. The static member's which we declared can be accessed directly with a type (syntax) <class name>.<member's name>.

    Code:- 
    Using system;
    namespace static_variables
    {
     class om
    {
    public static string name, location;
    public static int age;
    public static void Get_Details();
    {
    Console.WriteLine("Name-{0},Location-{1},age{2} ", name,location,age);
    }
    }
    class details
    {
    static void Main(string[] args)
    {
    om.name="Vivekanand";
    om.location="Jhunsi";
    om.age= 20;
    }
    }
    }

     

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.