can we create a instance for intwerface?

Answer Posted / subhash

No.We cannot create instance for interface.But we can
create reference to an interface.We can implement the
interface by creating sub class(implementation class) and
creat instance to the sub class, then you can create
reference to the interface by assigning instance of sub
class to the interface reference variable.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you escape json?

766


State two differences between C and Java.

965


How to create a custom exception?

759


How do we access static members in java?

852


How do you declare an empty string?

861


What is the difference between import java.util.date and java .util?

817


What is an i/o filter?

1222


Write a program in java to find the maximum and minimum value node from a circular linked list.

786


How define set in java?

782


What are the differences between heap and stack memory?

767


What is a website container?

702


Can a class be declared as protected?

754


What is the difference between I ++ and ++ I in java?

739


What’s the difference between callable and runnable?

767


What is assembly used for?

781