class Temp {
public static void main(
String args[]) {
int x;
x=10;
if(x==10)
{
int y=20;
System.out.println("x is " +x);
System.out.println("y is " +y);
x=y*20;
}
System.out.println("x is" +x);
/***************************doubt****************/
IN the above line x should print 10 since x=y*20 value should be retained in the block only ,but when i run this program i get x=40 ?? can anyone tell why?
}
}