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

What do you mean by inner class in java?

1077


How many bytes are there?

995


What is difference between char array and string?

1108


What do you mean by ordered and sorted in collections in java?

989


Explain the polymorphism principle?

1005


Define interface in java?

1071


What is a generic code?

1048


What is Mutex (Mutual Exclusion Object) ?

1141


What language is pass by reference?

1007


explain copyonwritearraylist and when do we use copyonwritearraylist?

942


how to convert Java project into Maven ?

1049


What is the difference between access specifiers and access modifiers in java? 16

991


Give me an example of array and linked list? Where they can be used?

1001


What are the advantages of unicode?

1008


What is cr keyboard?

1237