What is an anonymous class?
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 |
What is a null class?
what is platform dependent translation and platform dependent programming language
What is difference between arraylist and list in java?
what is mean by String and StringBuffer? What is mean by Methooverriding and Overloading?
Differentiate between a constructor and a method? Can we mark constructors final?
What are data types in oop?
tell me some common
What are three advantages of using functions?
How do you make a thread in java?
What is collection class in java?
Difference between object instantiation and construction ?
Difference between array and arraylist.
23 Answers Arise Solution, Banca Sella, iFocus, NIC, Sai Softech, Solartis, TCS, Verizon,