anonymous classes

class base
{

public void disp()
{
}

}

class anony
{

base obj=new base(){
void start()
{
}

};

void call()
{

base obj2=new base()
obj2.start();// is it valid or not if not plz give desc
obj2.disp();// is it valid....plz give desc
}

}
[348 byte] By [eshu2410] at [2007-11-20 8:18:49]
# 1 Re: anonymous classes
1) Please use code tags (see signature below)
2) This sounds quite a bit like a homework problem. (If so, please see below).
TheCPUWizard at 2007-11-10 2:15:22 >
# 2 Re: anonymous classes
obj2.start();// is it valid or not if not plz give desc
obj2.disp();// is it valid....plz give descWhat happens when you try this?

Good teaching is more a giving of the right questions than a giving of the right answers...
J. Albers
dlorde at 2007-11-10 2:16:22 >
# 3 Re: anonymous classes
What happens when you try this?

Good teaching is more a giving of the right questions than a giving of the right answers...
J. Albers

You get a compiler error because class Base doesn't have a start method.
_uj at 2007-11-10 2:17:23 >
# 4 Re: anonymous classes
base obj2=new base()And what about this line which also wont compile.
keang at 2007-11-10 2:18:28 >