can you create interface instance ?

Answer Posted / bibhuti

i am bit confused with this one.
If it is referring to an anonymous class then if i am changing like below then why it is not working?

public static void main(String[] args) {
Object t = new TestOne() {
public void wish() {
System.out.println("output: hello how r u");
}
};
t.wish();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by constant time complexity?

590


What are class types in java?

561


Why is stringbuffer faster than string?

474


How many ways can you break a singleton class in java?

476


What does int argc char * argv [] mean?

500






What are streams?

620


What is java Applet?

636


Explain Basics of OOP Language in java

573


What is the main advantage of passing argument by reference?

490


Explain what pure virtual function is?

581


Will set allow duplicates in java?

491


What are predicates in java 8?

520


What is string variable?

545


What are the advantages of encapsulation in java?

541


Which one will take more memory: an int or integer?

756