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

What is the difference between int and integer in java?

0 Answers  


How to sort list of list in java?

0 Answers  


Explain about automatic type conversion in java?

0 Answers  


If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?

0 Answers   CDAC,


Explain the difference between a Thread and a Process.

0 Answers   Ciena,


int a=1,b=10; System.out.println(a+b--);

12 Answers   HCL,


Is it safe for adding 10,00,000 records/objects to HashMap?, i.e is it safe to add millions of objects to HashMap?

2 Answers  


Can an unreachable object become reachable again?

3 Answers  


Can we call virtual funciton in a constructor ?

0 Answers   XX,


how and when compiler knows that the Java code throws the checked Exception.

2 Answers   HSBC,


what is the difference between abstract class and Interface?where we can use it in realtime projects?

23 Answers   Agile Software, Cognizant, IBM, Innodata, Logica CMG, Mitosis, Nagarro, Value Chain,


Can we override the static method?

0 Answers  


Categories