can you create interface instance ?
Answers were Sorted based on User's Feedback
Answer / anil
Uday..........Plz change ur name to James Gosling
Jr......dat suits u
| Is This Answer Correct ? | 0 Yes | 28 No |
Answer / udaykiran
Why Not?
Yes, Even we can create an instance of interface and
abstract class also.
just see this below simple example
Main.java
-----------
interface Test
{
public void wish();
}
class Main
{
public static void main(String[] args)
{
Test t=new Test()
{
public void wish()
{
System.out.println("output: hello how r u");
}
};
t.wish();
}
}
cmd> javac Main.java
cmd> java Main
output: hello how r u
in above case Test is an interface but i created the object
for that interface.
| Is This Answer Correct ? | 54 Yes | 92 No |
What is exception and error? and what is the difference between them?
Which collection is thread safe in java?
What is arguments in java?
Can we extend singleton class in java?
Explain the importance of join() method in thread class?
What is the difference between multitasking and multithreading in Java
0 Answers Sans Pareil IT Services,
Why char array is favored over string for the storage of passwords?
What is the difference between iterator and enumeration ?
In Inheritance if we are implementing Multi level inheritance and all class having same name of variable and now i want to access each class variable and how it is possible?
What are the super most classes for all the streams?
When do we use hashset over treeset?
Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?
0 Answers Akamai Technologies,