Even in real life to avoid complexity sometimes categorization could be very useful. In super market, for
instance, to facilitate shopping, generally products are categorized. İf not so, can you imagine while buying a bread you also looking at the price tag of a dishwashing liquid? We don’t want it right?
Similarly Java use this logic to prevent possible errors. But firstly we should know that according to the Java, scope means a field inside the two curly brackets.
Suppose that we start to write code in which we will have some variables that have the same name. How do you think java find out exactly which variable you want to use at there? That instant java uses the scope method to avoid complexity.
Let’s make our example concrete.Continue reading