Bird
0
0

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:
  1. Step 1: Recall correct order of modifiers

    The correct syntax places 'static' after the access modifier 'public'.
  2. 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.
  3. Final Answer:

    public static void Display() { } -> Option A
  4. 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

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes