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 we create a instance for intwerface?

Answer Posted / amit kumar gautam

Though it is correct that interfaces are basically used for
obtaining the dynamic resoulution of the Method and they
usually can not be instantiated but it is also possible to
instantiate the same in case of anonymous classes and it
works fine.......


class Amit
{

void addCode()
{
Runnable rr=new Runnable()
{
public void run()
{
System.out.print("This is Amit")
}
};
Thread tt=new Thread(rr);
tt.start();

}
}

class Check
{
static public void main(String[]amit)
{
new Amit().addCode();
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there any difference between nested classes and inner classes?

1043


What is the loop in java?

1063


What is instance example?

922


What is the relationship between clipping and repainting under awt?

1104


Is it correct to say that due to garbage collection feature in java, a java program never goes out of memory?

983


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

945


Differentiate between vector and array list.

1005


What is java volatile?

970


What is toarray method in java?

1041


What is the symbol for space?

937


Difference between method overloading and method overriding in java ?

1042


What are the advantages of functions?

874


What is the buffer limit?

989


What is parsing in grammar?

983


What mechanism does java use for memory management?

933