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...

did interface can implementation method ? i know its not
possible but my interviewer said its possible ..but how..?
any one have idea ???

Answer Posted / lakshmikanth

We can implement the method in the interface anonymously.

for example :

public class TestInterface {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
A o1= new A(){
public void f()
{
System.out.println("testing ....");
}
};
o1.f();
}

}
interface A
{
void f();
}

please let me know our concerns .

Lakshmiakanth.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of design patterns are there?

1043


Which is a valid identifier?

1097


Why heap memory is called heap?

986


os is developed in c no java is more secured then c na why dont the os developed is developed using java

4126


Do you know how to reverse string in java?

1086


Difference between method overloading and method overriding in java ?

1019


What is the difference between abstract classes and interfaces?

970


Java Compiler is stored in JDK, JRE or JVM?

1468


What do you mean by an object in java?

1074


What are different type of exceptions in java?

911


What is wrapper class example?

931


Is empty in java?

991


How transient variable is different from volatile variable?

1014


Is java a utf 8 string?

929


How do you identify if jvm is 32-bit or 64-bit from java program?

908