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

Explain inheritance in java?

1006


How can you set an applet’s height and width as a percentage?

939


What is string in java is it a data type?

1026


What is return type in java?

1079


What is your platform?s default character encoding and how to know this?

2382


how can i use a nonsynchronized hashtable?

2577


What about abstract classes in java?

1077


How hashmap works in java?

1056


What do you mean by an interface in java?

1038


How is hashcode calculated in java?

1044


What is the purpose of nested class in java?

1098


What are the advantages and disadvantages of object cloning?

1111


Explain heap sort?

1129


What is method overloading in JAVA? Why is it not present in C ?

1114


What is a generic type?

1020