can you create interface instance ?

Answers were Sorted based on User's Feedback



can you create interface instance ?..

Answer / prakash

!!!!!!!!!!!!!!!!!!marvelous!!!!!!!!!!!!!

Is This Answer Correct ?    2 Yes 23 No

can you create interface instance ?..

Answer / guest

sdfg

Is This Answer Correct ?    35 Yes 59 No

can you create interface instance ?..

Answer / anil

Uday..........Plz change ur name to James Gosling
Jr......dat suits u

Is This Answer Correct ?    0 Yes 28 No

can you create interface instance ?..

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

Post New Answer

More Core Java Interview Questions

What are uses of Hash Code?

2 Answers   Cognizant,


What is the point of polymorphism java?

0 Answers  


What is the declaration statement?

0 Answers  


How do you check if two given string are anagrams?

0 Answers  


Can private members of a base class are inheritable justify?

0 Answers  


How do you remove duplicates in java?

0 Answers  


there are some duplicate values in ArrayList, how U'll get that array with out duplicate?

4 Answers   CMC,


Write a program to find maximum and minimum number in array?

0 Answers  


java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

7 Answers   HCL, Wipro,


What is the integer of 16?

0 Answers  


How to instantiate static nested classes in java?

0 Answers  


Variable of the boolean type is automatically initialized as?

0 Answers  


Categories