class Demo
{
public static void main(String[] args)
{
int x=6;
show(x);
System.out.println(x);
}
public static void show(int x)
{
x=5;
}
}
==================
class Demo
{
int x=6;
public static void main(String[] args)
{
Demo d=new Demo();
d.x=8;
show(d);
System.out.println(d.x);
}
public static void show(Demo d)
{
d.x=5;
}
} |