Subject |
call |
is part of |
destroy in |
add |
declare |
protect |
is a subtopic of |
name after |
access |
declare by |
be only accessible to |
create |
refer to |
access by |
have typically |
|
extend |
implement by |
has part |
provide |
place in |
represent |
inherit |
return to |
contain |
have purpose |
is a synonym of |
pass as |
have example |
instantiate you |
implement |
import from |
have scope |
be part of |
belong to |
order |
is a kind of |
overload |
call when |
be a descendant of |
define |
specify by |
have access modifier |
compile by |
inherit by |
hide |
use |
override |
have syntax |
have benefit |
be a member of |
be not |
have |
have part |
return |
has definition |
be |
is partitioned into |
facilitate |
class | | | | 0 or more methods to the methods it inherits from its superclass | a list of variables, called instance variables, corresponding to data that will be present in each instance | its members from access by other classes or objects using an access modifier | Classes | the internals of a computer system such as 'Record', 'Table', 'Data', 'Structure', or 'Information' | any public class in other packages | | | | | | | | only one superclass | | | implementation for all its instance methods unless the class is abstract | its own source file | several similar objects | behaviour from its superclass | | data associated with each object | | | | public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } | create an instance of it | more than one interface | a package | | | | elements as follows: - class variables
- instance variables
- constructors
- the most important public methods
- methods that are simply used to access variables
- private methods
| specification | | | Object class | a class type whose instances are the values of the class type | 1 class definition | | | | | an implements clause to declare that it contains methods for each of the operations specified by the interface | methods that are inherited from the class's superclass | class classname { // declarations of variables // declarations of constructors // declarations of other methods with public ones first } | | 1 named package rather than the default package | | a unique name since somebody in the future might want to import the packages containing both classes and hence create a name clash | constructor | | A template that describes the data and behaviour of its instances called objects | the unit of data abstraction in an object-oriented program | abstract class, concrete class | |
constructor | the zero-parameter constructor in the direct superclass first | class | | | | | Constructors | | | | | | | | 1 or more arguments that determine some of the values of the variables of the class | | | | | a way to initialize a new object | | | | | | to initialize the instance variables of a newly created object and perform any other needed initialization | | | //Example of constructor for the class Stack public Stack() { items = new Vector(10); } | | | | | | | | access unit | using method name overloading | the new operator is used to create an instance of a class | | | | | | a subclass | | a constructor of the class's superclass with a super() call | | | | | a method | the same name as its class | | a value | A procedure that is called whenever a new object is created | | | data abstraction |
interface | | | | | | | Interfaces | | | | classes that are defined in the same package unless the interface is public | | | | | | 1 or more interfaces | 1 or more class | | many of the same benefits as multiple inheritance | | | all constants and methods from its superinterfaces | | abstract methods | | abstract data type | | public interface Drawable { public abstract Image drawImage(); public abstract Image drawImage(int height, int width); public abstract Image drawBlackAndWhiteImage(int height, int width); }
| | | | | | | | specification | | | | a set of methods | | public, or none | the Java compiler into a .class file | | | | | public interface InterfaceName extends SuperInterfaces { InterfaceBody } | | 1 named package | | 1 or more superinterfaces | interface definition | | A named collection of method declarations (without implementations), may also include constant declarations (variables marked static and final) | abstract by definition - the modifier is optional in the declaration | | |
method | | | | | | | Methods | | all instance variables of all objects of its class | | | an object by instantiating a class | | other methods and variables in any class in the same package by default | | | | | a block of implementation code | | | | | its caller from only one place which should be the last statement | return statement unless it has a void return type | | member function | an argument to a method or constructor | | | | | | a class or an object | a class | | specification | | | | its return type | | | | | instance variables, class variables from other objects | the super method to invoke a method declared in the superclass | a method in a superclass with the same name | | | | | a comment at its head if the method is non-obvious | method signature | a value that is of the return type of the method or a subtype of that type | Code that specifies some of the behaviour of a class or instance | public except for those that will definitely need to be called from outside the package | static method, instance method | |
variable | | | the block where it is declared | | | | Variables and Data Types | | | giving the data type followed by the name of the variable | | | a class or an object or a primitive datum | other variables and methods in any class in the same package by default | | | | | value | | | | | | only values that are of the same type as the variable or a subtype of the variable's type | to refer to an object or a class or a primitive datum | | | | | | | | | | | access unit | | | | | | | | | | | | | | | | comment if it is non-obvious | | | An item of data named by an identifier | as private as possible | member variable, local variable, formal parameter | |