Bird
0
0

Which of the following is the correct syntax to declare a static method in Java?

easy📝 Syntax Q3 of 15
Java - Static Keyword
Which of the following is the correct syntax to declare a static method in Java?
Apublic static void methodName() {}
Bstatic public void methodName {}
Cvoid static public methodName() {}
Dpublic void static methodName() {}
Step-by-Step Solution
Solution:
  1. Step 1: Recall Java method declaration order

    The correct order is access modifier, then static keyword, then return type, then method name.
  2. Step 2: Check each option

    public static void methodName() {} follows the correct order: public static void methodName()
  3. Final Answer:

    public static void methodName() {} -> Option A
  4. Quick Check:

    Static method syntax = public static returnType name() [OK]
Quick Trick: Access modifier before static keyword in method declaration [OK]
Common Mistakes:
  • Placing static after return type
  • Mixing order of keywords in method declaration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes