What is the scope of a variable defined inside java try block? Why it is not accessible outside of the try block?
问题 In the below java program even though the member "x" is defined outside the try block, it is accessible inside the try block. In case of "y", it is defined inside try block. But it is not accessible outside the try block. Why it is so? package com.shan.interfaceabstractdemo; public class ExceptionDemo { public static void main(String[] args) { int x = 10; try { System.out.println("The value of x is:" + x); int y = 20; } catch (Exception e) { System.out.println(e); } System.out.println("The