Which one of the statement given in options is false?
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Which one of the statement given in options is false?
Show answer & explanation
Static methods are NOT always private—they can be public, protected, or private depending on the access modifier specified. Static methods are defined at the class level, not the object level, and their visibility is determined by their access modifier. Options A, C, and D are all correct statements about static initialization blocks and static method behavior.
Step-by-step Derivation:
Let's evaluate each statement:
A) TRUE: Static blocks (static { }) are used to initialize static variables when the class is loaded into memory. They execute once per class load, before any instances are created.
B) FALSE: This is the incorrect statement. Static methods can have any access modifier:
- public static void method() { } — accessible from anywhere
- private static void method() { } — accessible only within the class
- protected static void method() { } — accessible within package and subclasses
- static void method() { } — package-private access (default)
Also, static methods are defined at the CLASS level, not the object level. The term "object level" is misleading here.
C) TRUE: A class can have multiple static blocks, and they execute in the order they appear in the source code (top to bottom).
D) TRUE: Static methods can be overloaded. A class can have multiple static methods with the same name but different parameter lists:
public static void display(int x) { }
public static void display(String s) { }
public static void display(int x, int y) { }