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 are the two ways in which thread can be created?

0 Answers  


In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

0 Answers  


Which data type is class in java?

0 Answers  


What do you mean by data type?

0 Answers  


What is array list in java?

0 Answers  


State the difference between strings and arrays.

0 Answers   Syntel, Visa,


What is the difference between a factory and abstract factory pattern?

0 Answers  


What do you mean by collectors in java 8?

0 Answers  


Can we have two main methods in a java class?

0 Answers  


What is arrays sort in java?

0 Answers  


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

0 Answers   Amazon,


What are different exception types exceptions available in java ?

0 Answers  


Categories