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?



What is an anonymous class?..

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

More Core Java Interview Questions

I have a String s = java; What is the output when I say s.replaceAll('j', 'k'); Also what is the value of s after replacing?

8 Answers   KPIT,


How do you reverse a word in java?

0 Answers  


What is update method called?

0 Answers  


What isan abstract class and when do you use it?

1 Answers   Genpact,


what is the use of reference variable

6 Answers  


how to run ecllipse with jettyserver for windows environment using batch file

0 Answers  


Explain OOPs concept.

0 Answers   Syntel, Visa,


What is difference between public static and void?

0 Answers  


Explain static nested classes ?

0 Answers  


Can I override protected method in java?

0 Answers  


How Applets & Servlets will communicate with each other?

2 Answers  


What is an array length?

0 Answers  


Categories