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 / sai

An anonymous class is a local class without a name. An
anonymous class is defined and instantiated in a single
succinct expression using the new operator.

Example:
class popcorn{
public void eat(){
syso("popcorn is sweet");
}
public void m1(){
syso("popcorm method");
}
class sample{
public static void main(String args[]){
popcorn p = new popcorn(){
public void eat(){
syso("popcorn is so hot");
}
};
p.eat();
p.m1();
}
}

Is This Answer Correct ?    17 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What technique is carried out to find out if a particular string is empty?

1011


How do you compare objects in java?

938


what are Hostile Applets?

2074


If you are given the name of the function at run time how will you invoke the function?

1128


Why set do not allow duplicates in java?

1080


Can we use catch statement for checked exceptions?

958


Is array passed by reference in java?

1024


What is final variable?

934


What happens when a thread cannot acquire a lock on an object in java programming?

1006


Does hashset allow duplicates in java?

1111


What is the benefit of abstract class?

942


Explain jdk, jre and jvm?

965


In which language java is written?

970


Is java ee a framework?

975


What are accessor methods in java?

1003