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 are the differences between graph and tree?

1124


Explain thread in java?

1175


Which language is java?

989


Why javac is not recognized?

945


What is a method signature java?

1058


Is zero a natural number?

1040


Write a function to find out longest palindrome in a given string?

1056


How many types of exception can occur in a java program?

991


What is the relationship between clipping and repainting under awt?

1150


Can each java object keep track of all the threads that want to exclusively access it?

952


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

1158


How do you get length in java?

1038


What is treeset in java?

1009


What are different types of references?

979


What is assembly language?

990