//illustra scope delle variabili definite in un blocco

import java.io.*;

class ScopeVar {
    public static void main(String[] args) {
	
	int x;       //dichiarazione
	x = 10;      //inizializzazione o definizione
	int y = 20;  //dichiarazione & inizializzazione contemporanea
	System.out.println("x: " + x + "\t\t  y: " + y);
	{
	    //double x; //ERR nasconde la var x int: java non permette questo!
	    double xx;  
	    xx = 3.14;
	    System.out.println("x: " + xx + "\t\t  y: " + y);
	}
  	System.out.println("x: " + x + "\t\t  y: " + y); 
        //System.out.print(xx); //ERR: qui var xx double non esiste
    }
}

/*
  output:      (nota: '\t' e' il carattere tab)
  x: 10     y: 20
  x: 3.14   y: 20
  x: 10     y: 20
*/
