NO. This will result in a compilation error. The try block must be followed by a catch or a finally block. It is legal to omit the either catch or the finally block but not both.
e.g. The following code is illegal.
int i =0;
}
int a = 2;
System.out.println(“a = “+a);
e.g. The following code is illegal.
try{
int i =0;
}
int a = 2;
System.out.println(“a = “+a);
No comments:
Post a Comment