Java - Static KeywordWhich of the following is TRUE about static blocks in Java?AThey can access instance variables directlyBThey can only access static variables and methodsCThey can be called explicitly like methodsDThey execute after the main methodCheck Answer
Step-by-Step SolutionSolution:Step 1: Analyze static block access rulesStatic blocks can only access static variables and methods because instance variables are not yet initialized.Step 2: Understand execution orderStatic blocks execute before the main method, not after.Final Answer:They can only access static variables and methods -> Option BQuick Check:Static block access = static members only [OK]Quick Trick: Static blocks access only static members, not instance ones [OK]Common Mistakes:Trying to access instance variables in static blocksThinking static blocks run after main methodTrying to call static blocks explicitly
Master "Static Keyword" in Java9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Java Quizzes Arrays - Why arrays are needed - Quiz 5medium Arrays - One-dimensional arrays - Quiz 12easy Arrays - Array length property - Quiz 4medium Memory Management Basics - Object lifetime - Quiz 10hard Memory Management Basics - Primitive vs reference storage - Quiz 1easy Methods and Code Reusability - Return values - Quiz 12easy Static Keyword - Static vs non-static behavior - Quiz 9hard Static Keyword - Static methods - Quiz 2easy Strings and String Handling - String creation - Quiz 11easy Strings and String Handling - Common string methods - Quiz 15hard