Java class | in a file of the same name | a list of variables, called instance variables, corresponding to data that will be present in each instance | The Basics of Java | the internals of a computer system such as 'Record', 'Table', 'Data', 'Structure', or 'Information' | to hold a responsibility if the responsibility cannot be attributed to any of the existing classes | class^2 | | class classname { // declarations of variables // declarations of constructors (discussed below) // declarations of other methods with public ones first } | only one superclass | | | | variables | its own source file | several similar objects | | data associated with each object | the pieces of data that describe some entity, so that programmers can manipulate that data as a unit | | particular low-level subsystems | a programmer to cope with the complexity of data | a domain model if you have to store or manipulate instances of it in order to implement a requirement | elements as follows: - class variables
- instance variables
- constructors
- the most important public methods
- methods that are simply used to access variables
- private methods
| Java module | | a box with the name of the class inside in a UML class diagram | the details of data | an implements clause to declare that it contains methods for each of the operations specified by the interface | | a unique name since somebody in the future might want to import the packages containing both classes and hence create a name clash | | abstract if it has one or more abstract methods | methods |
Java method | | | 9.1 - The Process of Design | | | | other methods and variables in any class in the same package by default | | | | when using a certain procedure, a programmer does not need to worry about all the details of how it performs its computations; he or she only needs to know how to call it and what it computes | procedural abstraction | | | | its caller from only one place which should be the last statement | | | | | | | | method | | | the details of procedures | | a method in a superclass with the same name | a comment at its head if the method is non-obvious | | public except for those that will definitely need to be called from outside the package | |