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 which of the following methods releases the lock when yield(), join(),sleep(),wait(),notify(), notifyall() methods are executed?
when there is a need of jvm then how we can say that java is a platform independent language?
i would like to attend for an interview of datalab technologies company i want to know the pattern of imnterview.
What is thread safe in java?
Matrix multiplication only using OOP concepts .
Is vector ordered in java?
Can inner class extend any class?
What do you mean by of string::valueof expression in java 8?
Is treeset sorted in java?
Which collection allows duplicate values in java?
What is a method ?
How to reverse a string in java?