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 |
Explain covariant method overriding in java.
Explain about OOPS concepts and fundamentals.
How do you replace all in word?
Can a class extend more than one class?
What are the problems faced by java programmers who don't use layout managers?
can we create instance for interface in java?
what is the difference between applet and swing and gui application in java . What we do with the collections set and list interface
2 Answers CTS, Phoenix Technologies,
How can we make a class singleton?
What do you mean by chromounits in java8?
What does the “final” keyword mean in front of a variable? A method? A class?
Tell me about your ability to work under pressure
What are kinds of processors?