// global variables int a = 5, b = 6, c = 7, d = 8; void sub2() { int a = 0, b = 3; //local variables { int b = 5; //local variable System.out.println("a=" + a); System.out.println("b=" + b); System.out.println("c=" + c); System.out.println("d=" + d); } } void sub1() { int a = 2, b = 4, c = 1; //local variables sub2(); } void main() { int a = 1, b = 2, c = 3, d = 4; //local variables sub1(); }\

Respuesta :

Answer:

1)

Static scoping

A=0

B=5

C=3

D=4

2) For dynamic scoping

A=2

B=5

C=1

D=8