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 ?

Answer Posted / arnold schwarzenegger

Yes we can create an instance of Interface but not directly but by using its subclass. Just check the below code


interface check
{
public void method1();
}
abstract public class B implements check
{

public static void main(String[] args)
{
check c = new check()
{
public void method1()
{
System.out.println("interface B m2");
}
};
c.method1();
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you explain inner class.

1089


What is java in simple terms?

1000


What is var keyword ?

1191


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

1101


What are scriptlets?

1089


How do you reverse sort a list in java?

940


What are the main uses of java?

992


How to check if linked list contains loop in java?

903


What is formatted output?

958


What is bifunction in java?

1203


What is an example of a constant variable?

1088


whatis Home interface and Remoteinterface? with example?

2007


How to perform linear search in java?

949


Why put method is idempotent?

918


What are annotations in java?

1095