- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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.
- Related Articles
- Can we change the order of public static void main() to static public void main() in Java?
- What is the Eclipse keyboard shortcut for "public static void main(String[] args) " in Java?
- What is the difference between keywords const and readonly in C#?
- What is the difference between VAR and DYNAMIC keywords in C#?
- What is the difference between JavaScript undefined and void(0)?
- What is the difference between throw and throws keywords in Java?
- What is the difference between keywords and reserved words in Java?
- What is the difference between super and this, keywords in Java?
- What is the difference between Static class and Singleton instance in C#?
- What is the difference between void, eval, and the Function constructor in JavaScript?
- Explain the difference between const and readonly keywords in C#
- Difference between void main and int main in C/C++
- What is the difference between static and dynamic polymorphism?
- What is the difference between static classes and non-static inner classes in Java?
- Difference between “int main()” and “int main(void)” in C/C++?

Advertisements