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 |
I have a String s = java; What is the output when I say s.replaceAll('j', 'k'); Also what is the value of s after replacing?
How do you reverse a word in java?
What is update method called?
What isan abstract class and when do you use it?
what is the use of reference variable
how to run ecllipse with jettyserver for windows environment using batch file
Explain OOPs concept.
What is difference between public static and void?
Explain static nested classes ?
Can I override protected method in java?
How Applets & Servlets will communicate with each other?
What is an array length?