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 is set in java?

1051


What is are packages?

1035


What are the two types of java?

1176


How do you create a bulleted list?

1256


What is object cloning in Java?

1112


Is string pool garbage collected?

1019


What does the string method compareto () do?

1061


What is ternary operator?

1010


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

2183


What is the use of default method in interface in java?

1010


Explain how hashmap works?

1067


How to find the given number is a prime number or not by getting input from the user

1100


Can we override the overloaded method?

1149


What are constants?

1053


What java is used for?

1079