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 percentage in java?
where is .equals() method and how is it different from == operation <giving some confusing implementation> Is hashing related to these?
What is polymorphism and what are the types of it?
what are the major differences between jdk1.4 and jdk1.5?
2 Answers Cap Gemini, Crimson Logic, Infosys, TCS, Tenth Planet,
What happens when heap memory is full?
What is object-oriented paradigm?
How to change the priority of thread or how to set priority of thread?
Java support what type of parameter passing ?
What are invisible components?.
What is meant by javabeans?
What is an empty string in css?
suppose string s1="rajnish"; string s2="bhaskar"; then what will be happend ?