0
According to google: the state of the environment in which a situation exists So in this case it most likely means the piece of code where you can access a certain variable because it exists in that area(its scope) Example: public class MyClass { int x =5; public void function (){ x=3; //Valid int y=2; } y=7; //Not valid because we are trying to access a variable out of its scope } In this scenario you can access y within the method called function, that means thats the scope of that variable. Note that you cant access y outside of the body function. Whereas you can access x within the class myClass, so thats its scope. Hint: the scope of a variable is usually determined by curly braces {}
9th Feb 2019, 11:16 PM
Jhon
Jhon - avatar