Block variables are defined in the enclosing method's scope and can be accessed only in the current scope and nested scopes. A block variable can be declared as either public, private or protected. The public declaration makes it available to any nested blocks, private restricts access to just this block and protected restricts access to methods within its own class or its subclasses.
Share a personalized message with your friends.