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
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
What is the difference between a constructor and a method?
Explain the scope of a variable.
What is the difference between preemptive scheduling and time slicing?
What are the differences between include directive and include action?
Can you achieve runtime polymorphism by data members?
Define nashorn in java8.
Can we have more than one package statement in the source file?
enlist some features of jdk.
What is the syntax and characteristics of a lambda expression?
What is the purpose of a transient variable?
What is bigger kb or mb?
what do you mean by stream pipelining in java 8? Explain
What is method reference in java?
why doesn't java run on all platforms?