import java.awt.*; import java.applet.*; //Demonstrate the Block Scope. // public class Scope extends Applet{ public void paint(Graphics g) { int x; //known to all code within main x = 10; if(x == 10) { //start new scope int y = 20; //known only to this bock g.drawString("x and y: " + x + " " + y,20,20); x = y * 2; } // y = 100; Error y not know here. // x is still known here. g.drawString("x is " + x,20,40); } }