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 / akthar

No,we can't create an object to an interface...as told uday he create a anonymous class same as Test interface ..if we remove the interface and method it is working ....so t doesnot act as object to an interface it acts as an anonymous class object...so it invoking its anonymous method..

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();
}
}

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 have two constructors in java?

897


How to declare objects of a class ?

1011


What is another word for methodology?

967


What is string example?

985


What is the difference between equals() and?

1113


What is the syntax and characteristics of a lambda expression? Explain

992


What do you mean by byte code?

952


What is difference between calling start() and run() method of thread?

1032


Can we have more than one package statement in the source file?

1020


What is an immutable class? How to create an immutable class?

997


worst case complexities of Quick sort and Merge sort.

944


What is dot operator?

967


explain autoboxing in java?

934


Differentiate between static and non-static methods in java.

993


What does void * mean?

950