Answer Posted / amit kumar gautam
Though it is correct that interfaces are basically used for
obtaining the dynamic resoulution of the Method and they
usually can not be instantiated but it is also possible to
instantiate the same in case of anonymous classes and it
works fine.......
class Amit
{
void addCode()
{
Runnable rr=new Runnable()
{
public void run()
{
System.out.print("This is Amit")
}
};
Thread tt=new Thread(rr);
tt.start();
}
}
class Check
{
static public void main(String[]amit)
{
new Amit().addCode();
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is there any difference between nested classes and inner classes?
What is the loop in java?
What is instance example?
What is the relationship between clipping and repainting under awt?
Is it correct to say that due to garbage collection feature in java, a java program never goes out of memory?
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
Differentiate between vector and array list.
What is java volatile?
What is toarray method in java?
What is the symbol for space?
Difference between method overloading and method overriding in java ?
What are the advantages of functions?
What is the buffer limit?
What is parsing in grammar?
What mechanism does java use for memory management?