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 |
Is null or empty java?
Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.
What is the use of jtable?
I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?
What is finalize()? Is finalize() similar to a destructor?
if arraylist size is increased from initial size what is the size of arraylist...suppose initial is 100 , if i add 101 element what is the size...
What do you understand by a Static Variable?
How do you override a variable in java?
What are autoboxing and unboxing? When does it occur?
What are some alternatives to inheritance?
Name the methods in mouse listeners ?
could you run the java program without main method?