Professional Documents
Culture Documents
10 Static Members
// Call by value.
class Test
{
void meth(int i, int j)
{
i++;
j++;
}
}
class CallByValue
{
public static void main(String args[])
{
Test ob = new Test();
int a = 22, b = 93;
System.out.print("a and b before call: ");
System.out.println(a + " " + b);
ob.meth(a, b);
void meth(Test o)
{
o.a++;
o.b++;
}
}
class CallByRef
{
public static void main(String args[])
{
Test ob = new Test();
ob.a = 22;
ob.b = 93;
System.out.println("ob.a and ob.b before call: " +
ob.a + " " + ob.b);
ob.meth(ob);