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 is numeric data type?

989


Why java is said to be pass-by-value ?

1043


How many times finalize method will be invoked? Who invokes finalize() method in java?

1020


Can a class have multiple constructors?

1060


What is a line separator in java?

980


What is null data type?

1101


What does file separator do in java?

1016


What is the properties class in java programming?

1004


Is it possible to use string in the switch case?

1043


What is the difference between a method and a function in alice?

1200


explain copyonwritearraylist and when do we use copyonwritearraylist?

951


What are the different http methods?

1036


How is final different from finally and finalize?

927


Why can't you declare a class as protected?

1134


Can subclass overriding method declare an exception if parent class method doesn't throw an exception?

1079