Friday, July 17, 2015

CareerCup: New Interview Question for

Passing objects and correct the program:---

class OdemoA
{
int i,j;
void function1(int i)
{
System.out.println(i);
System.out.println("Inside function()");
}
void function2(Area a1)
{
if(a1!=null)
{
a1.i=203;
a1.j=115;
}
System.out.println(a1);
System.out.println("end of function2()");
}
public static void main(String args[])
{
OdemoA d1 = new OdemoA();
Area a2 = new Area();
d1.function2(a2);
System.out.println(a2.i);
System.out.println("end main");
}
}

View »
Posted by Avinash on July 14, 2015

by via CareerCup RSS Feed

No comments:

Post a Comment