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 was java originally called?

514


how to write a program for sending mails between client and server

1557


Differences between traditional programming language and object oriented programming language?

574


Why is java so important?

653


List any five features of java?

568






Which is dependent variable?

498


What is the purpose of file class?

550


Which number is denoted by leading zero in java?

815


Compare java and python.

581


Why vector class is used?

546


How do you sort a string in alphabetical order in java?

537


How do listeners work?

514


What is a nullable field?

581


What is a null point?

559


What is the finalize method do?

604