code methodlocal innerclass
package innerclass;
public class MethodOuter {
// int x=10;
public void m1()
{
int y=20;
class MethodInner
{
public void display(int x,int y)
{
System.out.println("SUM IS"+(x+y));
}
}
MethodInner in=new MethodInner();
in.display(10,20);
in.display(100,200);
}
public static void main(String ar[])
{
MethodOuter o=new MethodOuter();
o.m1();
}
}
output:
SUM IS30
SUM IS300
0 comments:
Post a Comment