Write a program to display scope variable can be nexted.

0
/* Write a program to display scope variable can be nexted. */

class Scopevar{
    public static void main(String args[]){
        int x;
        x=10;
        if(x==10){
            int y;
            y=100;
            System.out.println("y="+y);
            }
        System.out.println("x="+x);
        }
    }

/*
Output:

E:>javac Scopevar.java
E:>java Scopevar

y=100
x=10

*/

About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts