In: Computer Science
What is the public interface of counter class in section 3.1 ? How does it differ from the implementation of the class?
Submission Folder | |
Chapter 3 Practice Exercise E3.1 | |
Instructions | |
Submit this assignment as an exported archive called CounterModified Textbook ISBN NUmber : 978-1-119-05645-4 |
interface : an interface is basically a kind of class .like calsses ,interfaces contain methods and variabnles but there is a major difference.i.e interfaces only abstract methods and final feilds .this means that the interfcae do not specify any code to implement these methods and data feilds contain only constants .therefore it is the responsibility of the class that implement an interface to define the code for implementation of these methods.
Public interface: here the public interface comprises of click,get values and reset methods which indicates the functionality assisted by the class but not the details that how to apply the pratical utilization.indicating the interface with public ( one of the kind of acess specifier) specifies that the interface is able to utillize through any class on any package.
class: classes are user defined data types and acts as built in types of a programming language.when we define a class ,we declare its exact form and nature .we do this by specifying the data tit contains and the code that operates on data .while very simple classes may contain only code or only data ,most real world classes contain both.A class code defines the interface to its data.