*/
abstract class abDemo
{
abstract void show();
}
class outer
{
int x=3;
/*
class inter extends abDemo
{
void show()
{
System.out.println("show :"+x);
}
}
*/
public void function()
{
//new inter().show();
abDemo d=new abDemo()
{
void show()
{
System.out.println( "x="+x);
}
void abc()
{
System.out.println("haha");
}
};
d.show();
//d.abc();//编译失败
}
}
class interclass2
{
public static void main(String[] args)
{
new outer().function();
}
}
|
|