What is interface and its use?

Answer Posted / guest

Interface is similar to a class which may contain method's
signature only but not bodies and it is a formal set of
method and constant declarations that must be defined by
the class that implements it.
Interfaces are useful for:
a) Declaring methods that one or more classes are expected
to implement
b)Capturing similarities between unrelated classes without
forcing a class relationship.
c)Determining an object's programming interface without
revealing the actual body of the class.

Is This Answer Correct ?    15 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a boolean expression in java?

536


Is arraylist a class in java?

536


Can you declare the main method as final?

526


Why is java so important?

650


Why do we use predicate in java?

558






What is e java?

557


What’s meant by anonymous class?

600


Does collectionutils isempty check for null?

816


What is final keyword?

646


What is JDBC Driver interface?How can you retrieve data from the ResultSet

1513


What is an example of a boolean?

570


How to find the largest value from the given array.

526


What are the types of arrays in java?

561


What is java oops?

558


What is the difference between conversation & casting?

580