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
Can a static method be final?
What is the collections api in java programming?
What is break and continue statement?
How do you input a string in java?
What is multi-catch block in java?
What are the types of methodology?
How many decimal places is a double?
How many boolean functions are there?
What is the basic of java?
What is difference between float and double?
Which object oriented concept is achieved by using overloading and overriding?
What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?
Implement a stack with push (), pop() and min() in O(1) time.
Difference between collection, collection and collections in java?
What are different types of multitasking?