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 parse method?

966


Why declare Main() method as a static in java ?

1030


What is constructor and its types?

1074


What is final modifier?

996


Does anyone still use java?

1062


What is unicode full form?

940


How we create object in copy constructor?

1077


What is the difference between Grid and Gridbaglayout?

1158


Explain JMS in detail.

978


What are the Main functions of Java?

1059


Are variables stored in ram?

965


Find the value of a specified element of the array arr[i] where 0 <= i <= n-1

935


Do I need to import java.lang package any time? Why?

1320


How do you sort a list in java?

984


What is int short for?

977