Where are member variables declared within a Java class structure?
AOutside methods
BIn loop headers
CIn catch clauses
DIn method bodies
Answer & Solution
Correct answer: A. Outside methods
Member variables are declared within the class body but outside of any method.
Keep practising Classes, Encapsulation and Scope
Browse all Classes, Encapsulation and Scope questions for ICSE Class 10, or explore more Computer Applications topics.
Related questions
Match broad forms:
1. ADT: p. Data type
2. Libs: q. Modules
3. Cap: r. SecurityMatch stack flow:
1. Push: p. In scope
2. Pop: q. Exit scope
3. LIFO: r. Stack ruleMatch name scopes:
1. Prefix: p. Qualify
2. Pack: q. Ada Java
3. Space: r. C++ namesMatch Java check:
1. Hide: p. Disallowed
2. Block: q. In braces
3. Top: r. Class modsMatch scope nest:
1. Close: p. Keep env
2. Inner: q. Sub-func
3. Outer: r. Non-localMatch lang spec:
1. CPP: p. 3 keys
2. Java: q. 4 types
3. Swift: r. 5 levelsMatch OOP tension:
1. Design: p. Patterns
2. Subcls: q. Expose
3. Yo-yo: r. Hard bugMatch Java fields:
1. Field: p. In class
2. Local: q. In block
3. Param: r. Signature