Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can you create interface instance ?

Answers were Sorted based on User's Feedback



can you create interface instance ?..

Answer / nilesh

We can create instance of Inteface. Also Interface can
extends another more than one interface. So plz check out.

Is This Answer Correct ?    0 Yes 1 No

can you create interface instance ?..

Answer / rushi shah

The above code given by Udaykiran gives the following error even before it is compiled:

Can not instantiate the type 'Test' type.

Which means that we can not create any object of interface.

Is This Answer Correct ?    0 Yes 1 No

can you create interface instance ?..

Answer / sharath

we can create an object for interface but the there will be
of no use because interface methods are abstract in nature
i.e they doesn't have any implementation..

Is This Answer Correct ?    0 Yes 1 No

can you create interface instance ?..

Answer / kishore emani

Hi Anil, In this case uday sounds good!
As per your consideration if it is an anonymous class then
just remove that interface from our application and try to
compile it won't compile that code.
Here Test is an interface, for which to create the object
we need to provide the complete implementation for that
interface the same thing which uday did.
and again u check it if(t instanceof Test)
it is returning true that means t is an instance for Test.
and here the object is creating in the heap.
at finally here an instance is created for an interface.

Is This Answer Correct ?    4 Yes 7 No

can you create interface instance ?..

Answer / guest

Hi all,

I think Udaya is right and i have tested in the same and its
working. But if you think about the way JAVA has to make
instances(e.g. A a = new A()) will not work. It will give
you compilation error. So there is something we are not able
to see. Even I am trying to get what this example actually
working.

Feel free to update me if I am wrong...&#9786;

Is This Answer Correct ?    1 Yes 7 No

can you create interface instance ?..

Answer / akhilesh

hey uday u r master in java yaar, by people like u we can
change the java world keep it up dude. just keep on posting
these kind of impossible things ok. Thanks a lot for that :)

Is This Answer Correct ?    14 Yes 23 No

can you create interface instance ?..

Answer / manish malav

amazing

Is This Answer Correct ?    2 Yes 11 No

can you create interface instance ?..

Answer / uday

Hi Deepesh, uday is back again

Hey just see the question . can you create interface
instance?
just say the answer Yes or No?
my answer is Yes
how is it possible? Already i gave the example.I know that
this is anonymous inner class concept. But i don't want to
exceed this concept for too complex. that's why i did it in
this manner.Any How i thanks to all of you for more inputs.

but u can create the instance for interface. how can we
check an instance is,using instance of operator only. here
it proved hence the affrimative ans is right. i am not
plmbbing your knowledge it's just a kind of inquiry. Thanks
FYI huh!!!!

Is This Answer Correct ?    1 Yes 12 No

can you create interface instance ?..

Answer / ram

hey amazing answer uday.

Is This Answer Correct ?    6 Yes 22 No

can you create interface instance ?..

Answer / sankar

Wov that was amazing Uday

Is This Answer Correct ?    6 Yes 25 No

Post New Answer

More Core Java Interview Questions

what state does a thread enter when it terminates its processing? : Java thread

0 Answers  


What are different types of multitasking?

0 Answers  


What is adapter class?

12 Answers  


How many bytes is a url?

0 Answers  


Why is the main method static?

0 Answers  


What is the difference between the synchronized() & static synchronized()?

2 Answers   HP, SparkTG,


What is exception hierarchy in java?

0 Answers  


HOW TO PRINT A NO IN WORDS USING WHILE LOOP THE NO WILL BE PRINTED WHEN IT WILL BE IN THE RANGE BETWEEN 1 AND 3?

1 Answers  


What is meant by local variable and instance variable?

0 Answers  


What is a class in java?

0 Answers  


What are the observer and observable classes?

1 Answers  


Can you use this() and super() both in a constructor?

0 Answers  


Categories