can you create interface instance ?

Answer Posted / john

@Uday Ur fooling amateur coders by creating an anonymous
class within the class . U cannot create an instance of an
Interface .If so try to make execute this code lol class

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

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is daemon thread and which method is used to create the daemon thread? : Java thread

518


Is string serializable in java?

538


Is vector ordered in java?

529


What is the meaning of variables in research?

522


What is comparable and comparator interface? List their differences

570






Explain 5 features introduced in jdk 1.7?

600


Can we declare an interface as final?

566


Is java a utf 8 string?

521


Which sort is best in java?

518


What are the parts of a method?

530


Is 0 an even number?

536


Explain the features of java?

580


how to split string in java?

643


Define array. Tell me about 2-D array.

580


What are variable arguments or varargs?

559