scope of variable

Write a program to scope of a variable.

 

import java.util.Scanner; class P13ScopeOfVariable { public static void main() { int y=4; { int x=5; } System.out.println("Value of x can't be acessed because it is out of scope of variable x \n\n" ); System.out.println("Value of y is " + y); System.out.println(" \n \n We can acess value of y because we are using it in same block of declaration"); } }


For any desired program, please comment below. We will try our best to make that program available.


Comments

Popular Posts