Which of the following is the correct syntax to declare a static method in C#?
easy📝 Syntax Q3 of 15
C Sharp (C#) - Classes and Objects
Which of the following is the correct syntax to declare a static method in C#?
Apublic static void Display() { }
Bpublic void static Display() { }
Cstatic void public Display() { }
Dvoid static public Display() { }
Step-by-Step Solution
Solution:
Step 1: Recall correct order of modifiers
The correct syntax places 'static' after the access modifier 'public'.
Step 2: Validate method declaration
public static void Display() { } correctly declares a static method with 'public static void Display()'. Other options have incorrect order or missing parts.
Final Answer:
public static void Display() { } -> Option A
Quick Check:
Static method syntax = public static [OK]
Quick Trick:Use 'public static' before method name [OK]
Common Mistakes:
MISTAKES
Placing 'static' after method name
Mixing order of modifiers incorrectly
Omitting access modifier
Master "Classes and Objects" in C Sharp (C#)
9 interactive learning modes - each teaches the same concept differently