jeudi 26 mars 2015

I cant able to understand this code i am getting 6 as output?



please explain this code i am getting the output as 6,anyone please help me.



class A
{
static int i=1111;
static
{
i=i-- - --i;
}
{
i=i++ + ++i;
}
}
class B extends A
{
static
{
i=--i - i--;
}
{
i=++i + i++;
}
}
public class Shadow2
{
public static void main(String[] args)
{
B b=new B();

System.out.println("Find->"+b.i);
}
}


output Find->6 Anyone help me to go through the code




Aucun commentaire:

Enregistrer un commentaire