Question: What happens when an instance variable with the same name as a static variable is declared in a class? Question 2 6 Answer a .
What happens when an instance variable with the same name as a static variable is declared in a class?
Question Answer
a
The instance variable shadows the static variable.
b
The static variable shadows the instance variable.
c
Both variables are accessible without any conflict.
d
It causes a compilation error.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
