- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between public, static and void keywords in C#?
All these keywords are part of the main method of any C# program.
The Main method, which is the entry point for all C# programs states that what a class does when it executed.
using System; class Demo { static void Main(string[] args) { Console.WriteLine("My first program in C#!"); } }
public − This is the access specifier that states that the method can be accesses publically.
static − Here, the object is not required to access static members.
void − This states that the method doesn’t return any value.
main − is As stated above, it s the entry point of a C# program i.e. this method is the method that executes first.
Advertisements