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 |
Why java is free from garbage values??
What is HashTable?
v-model life cycle
write a program to create an arraylist and listeterator.and value should be enter through keyboard.
What is application system?
Can you sort a string in java?
what is the significance of listiterator in java?
Can you instantiate the math class?
Can an object be null?
Is arraylist ordered in java?
What is the difference between final, finally and finalize()?
Same common question what is Map,Set,HashMap,List????