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 an anonymous class?

Answer Posted / venki

3) Anonymous classes:
1. A class which doesn’t have any name is called anonymous class and which is a type of inner class. It can be either member class or local class.
2. It is a sub class that extends a class or implements an interface but not both. It can implement only one interface.
3. These are used where implementation of methods various from one object to another object. Anonymous class is final class.
4. public class Demo{
A a=new A();
a.m1();
A 1=new A(){ void m1(){ --- }};
a1.m1();
}
On compiling this above program the java compiler generates A.class, Demo.class and Demo$1.class (Anonymous class).

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What isan abstract class and when do you use it?

1672


Can we override compareto method?

995


Does java list allow null?

1041


Can an integer be a string?

1153


What is the difference between method and means?

1132


When is the finally clause of a try-catch-finally statement executed?

1141


Explain aggregation in java?

1019


List some java keywords sun like c, c + + keywords?

1066


What are the skills required for core java?

1074


A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.

1060


How to create a thread in java?

1197


Write a code to create a trigger to call a stored procedure

1032


Explain with example the concept of constant variable in java.

1265


What is package private scope in java?

997


Can we use different return types for methods when overridden?

1063