Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the use of anonymous inner classes ?

Answer Posted / ashokkumar

Anonymous classes

1.These are one type of inner class that having no mame.

2.The syntax will come like

class a
{
public void mymethod ();

}
class b
{
a obja = new a(){//the anonymous class starts here
public void mymethod (){ //have to implement the methods of
//class 'a'
return "here we are implementing mymethod of class 'a'"
}

}; //when finishing anonymous classes we have to put";"

}

3.Here the anonymous class is consider as a sub class of
class 'a'.We can access all the variables and methods of
super class 'a' through the anonymous block,except local
variables,including private variables.

4.Through anonymous classes we can create instance for
Interfaces.

Is This Answer Correct ?    19 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between the methods sleep() and wait()? : Java thread

906


Is final static java?

952


Describe the process as to how substring() methodology mechanisms in java.

1044


Explain the difference between extends thread vs implements runnable in java?

1059


Implementations of set interface?

942


Explain the use of volatile field modifier?

1022


What is string immutability?

1025


What is consumer interface?

946


What is io stream in java?

971


Explain scope or life time of local variables in java?

966


What are green threads in java?

946


Which is bigger float or double java?

925


What is a parameter in java?

951


Why destructor is not used in java?

927


Difference between string, stringbuffer and stringbuilder?

985