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 are destructors defined in java?

993


What is comparable and comparator interface? List their differences

1042


Implementations of set interface?

957


What is %d in printf?

1000


What is a private class in java?

981


What are the legal parameters?

949


Is boolean a data type in java?

908


What is object-oriented paradigm?

1017


What is a qms manual?

948


What is an exception in java?

1071


What will be the output of round(3.7) and ceil(3.7)?

1072


What are the differences between abstract class and interface?

1000


What is memory leak and how does java handle it?

938


What is core java called?

930


What is callablestatement? How you can call stored procedure to pass in parameter?

984