Object Oriented Software Engineering   View all facts   Glossary   Help
subject > component > module > Java module > Java class > Java class that implements an interface
Next Java classJava class that imports a package    UpJava class    Previous Java classJava class in a package   

Java class that implements an interface
subjectfact 
Java class that implements an interfacedoes not have to be related to other classes that implement the same interface in any other waylink: chapter2section2.8.html#948, 2001-08-30 14:56:11.0
is a subtopic of The Basics of Java2001-08-30 14:56:11.0
is a kind of Java class2001-08-30 14:56:11.0
Java classcan extend only one superclass2001-08-30 14:56:09.0
can have more than one constructor each of which has different sets of arguments2001-08-30 14:56:09.0
can have the same name as another class if the two classes are not in the same package and their packages are never imported into the same file2001-08-30 14:56:09.0
can implement more than one interface2001-08-30 14:56:09.0
has form
class classname
{ // declarations of variables
// declarations of constructors (discussed below)
// declarations of other methods with public ones first
}
2001-08-30 14:56:10.0
is abstract if it has one or more abstract methods2001-08-30 14:56:10.0
is stored in a file of the same name2001-08-30 14:56:10.0
may implement particular low-level subsystems2001-08-30 14:56:10.0
should be placed in its own source file2001-08-30 14:56:10.0
should have a unique name since somebody in the future might want to import the packages containing both classes and hence create a name clash2001-08-30 14:56:10.0
should order elements as follows:
  1. class variables
  2. instance variables
  3. constructors
  4. the most important public methods
  5. methods that are simply used to access variables
  6. private methods
2001-08-30 14:56:10.0
uses an implements clause to declare that it contains methods for each of the operations specified by the interface2001-08-30 14:56:10.0
classcontains all of the code that relates to its objects including
  • code describing how the objects of the class are structured - i.e. the data stored in each object that implement the properties
  • The procedures, called methods, that implement the behaviour of the objects
2001-08-30 14:54:50.0
contains data associated with each object2001-08-30 14:54:50.0
declares a list of variables, called instance variables, corresponding to data that will be present in each instance2001-08-30 14:54:50.0
has part class name2001-08-30 14:54:50.0
has part class variable2001-08-30 14:54:50.0
has part code2001-08-30 14:54:50.0
has part constructor2001-08-30 14:54:50.0
has part instance variable2001-08-30 14:54:50.0
has part method2001-08-30 14:54:51.0
has part variables2001-08-30 14:54:51.0
is divided up into methods2001-08-30 14:54:51.0
is drawn as a box with the name of the class inside in a UML class diagram2001-08-30 14:54:51.0
is needed in a domain model if you have to store or manipulate instances of it in order to implement a requirement2001-08-30 14:54:51.0
represents several similar objects2001-08-30 14:54:51.0
see also class^22001-08-30 14:54:51.0
should be created to hold a responsibility if the responsibility cannot be attributed to any of the existing classes2001-08-30 14:54:51.0
should be named after things their instances represent in the real world2001-08-30 14:54:51.0
should not be named after the internals of a computer system such as 'Record', 'Table', 'Data', 'Structure', or 'Information'2001-08-30 14:54:51.0
data abstractiongroups the pieces of data that describe some entity, so that programmers can manipulate that data as a unit2001-08-30 14:55:09.0
helps a programmer to cope with the complexity of data2001-08-30 14:55:09.0
hides the details of data2001-08-30 14:55:09.0
modulehas high cohesion if related aspects of a system are kept together in this module, and unrelated aspects are kept out2001-08-30 14:56:38.0
lacks side effects if it does not modify any data, and does not leave behind any information, other than its result, that would have an effect on other computations2001-08-30 14:56:38.0
componentmay perform a special-purpose function such as the user interface for a particular system2001-08-30 14:55:00.0

Next Java classJava class that imports a package    UpJava class    Previous Java classJava class in a package