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 / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

what are Hostile Applets?

2146


What is the this keyword?

1089


What causes memory leak in java?

987


List two java ide’s?

1096


What is the primary benefit of encapsulation?

1152


Which object oriented concept is achieved by using overloading and overriding?

1183


Explain the importance of thread scheduler in java?

1057


What do you understand by copy constructor in java?

979


How many bytes is a unicode character?

1061


List some oops concepts in java?

1088


What is set in java?

1101


How can we make copy of a java object?

1212


What is the purpose of the finalize() method?

1297


What are the major advantages of internal iteration over external iteration?

1106


Why isn’t there operator overloading?

1141