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

What is an error in java?

1144


How does remove work in java?

966


What are the various access specifiers in java?

999


Which class cannot be a subclass in java?

1013


What is difference between char array and string?

1108


What is better- service oriented or batch oriented solutions?

2206


What is meant by method?

1098


Can we use different return types for methods when overridden?

989


What is a dot notation?

1026


How is string immutable in java?

1029


How do I start learning java?

1060


What about abstract classes in java?

1059


What is lazy initialization in java?

994


Why volatile is used in java?

1052


What is the meaning of flag day?

1019