subclass | |  |
|  |
|  |
|  |
can access hidden member variables using the keyword super |  |
can access overridden methods using the keyword super |  |
can hide an inherited member variable by declaring a member variable with the same name |  |
can override an inherited method by defining a method with the same signature |  |
can use any member that is inherited |  |
cannot be defined until its direct superclass has been defined |  |
cannot override any class method (a method that is declared static in the superclass) |  |
cannot override any method that is declared final in the superclass |  |
has definition A class that is an extension of another class, and hence inherits from the other class |  |
does not inherit constructor |  |
does not inherit the private members of its superclass |  |
has example of creation public class Movie extends Attraction |  |
inherits 0 or more methods from its superclass and all of its ancestors |  |
inherits 0 or more variables from its superclass and all of its ancestors |  |
inherits all instance variables and methods defined in its ancestor classes  |  |
inherits all package members of its ancestors |  |
inherits all protected members of its ancestors |  |
inherits all public members of its ancestors |  |
inherits none, some or all of its behaviour from all its ancestors |  |
inherits none, some or all of its state from all its ancestors |  |
is a subtopic of Classes |  |
is created using the extends keyword  |  |
is a kind of descendent |  |
class | adds 0 or more variables to the variables it inherits from its superclass |  |
adds 0 or more methods to the methods it inherits from its superclass |  |
can be imported from a package |  |
can extend only one superclass  |  |
can have a main method |  |
can have instances |  |
can have more than one constructor each of which has different sets of arguments  |  |
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 file  |  |
can implement more than one interface  |  |
can protect its members from access by other classes or objects using an access modifier |  |
contains all of the code that relates to its objects including  |  |
contains data associated with each object |  |
declares a list of variables, called instance variables, corresponding to data that will be present in each instance  |  |
has |  |
has 0 or more subclasses |  |
has 1 superclass except Object class which has no superclass |  |
has behaviour that is specified by its instance methods |  |
has more specialized behaviour than a class farther up in the class hierarchy |  |
has public interface which contains its public instance variables and instance methods |  |
has benefit |  |
has example public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } |  |
has part class name |  |
has part code |  |
has part constructor  |  |
has syntax class classname { // declarations of variables // declarations of constructors // declarations of other methods with public ones first }  |  |
is abstract if it has one or more abstract methods |  |
is the unit of data abstraction in an object-oriented program  |  |
is a descendant of Object class |  |
is specified by 1 class definition |  |
may have access modifier |  |
provides implementation for all its instance methods unless the class is abstract |  |
represents several similar objects |  |
should be a member of 1 named package rather than the default package |  |
should be named after a thing its instances represent in the real world |  |
should be placed in its own source file  |  |
should have a comment at the top describing the purpose of the class, how it should be used, its authors and its history of modification |  |
should have a unique name since somebody in the future might want to import the packages containing both classes and hence create a name clash  |  |
should not be named after the internals of a computer system such as 'Record', 'Table', 'Data', 'Structure', or 'Information'  |  |
should order elements as follows: - class variables
- instance variables
- constructors
- the most important public methods
- methods that are simply used to access variables
- private methods
|  |
to instantiate you create an instance of it |  |
access unit | has access mode |  |
syntactic unit | has syntax rule bold = mandatory italic = non-terminal normal font = optional |  |