Subject |
access directly |
is an instance of |
declare |
call by |
is a subtopic of |
access from |
have result |
refer to |
see also |
access by |
|
provide |
place in |
work by |
specify |
contain |
use by |
have purpose |
provide access to |
is a synonym of |
mark as |
have example |
override by |
implement |
be implicitly |
have access to |
be part of |
operate on |
is a kind of |
clean up |
have example of calling |
avoid |
affect |
allow |
inherit by |
use |
override |
access you |
have arguments |
have |
has definition |
divide into |
be |
facilitate |
accessor method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | if you anticipate that the detailed definition of a class may change because this will isolate the effects of potential changes | | | | return statement unless it has a void return type | | | imaginary instance variable that exist only in the sense that their values can be computed from instance variables that do exist | | | | | | | | a class or an object | | method | | | | | you to include additional computation, for example writing out a message | | 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 | A method which returns (getter) or changes (setter, mutator) the state of an object | | public except for those that will definitely need to be called from outside the package | data abstraction |
class method | any instance variable | | | using the name of the class, followed by a dot, followed by the name of the method (the name of the class can be omitted when calling a class method in the current class) | Methods | | | | | other methods and variables in any class in the same package by default | | | | | the behaviour of the class | return statement unless it has a void return type | every method of the class | implementing functions such as initializing a class, or operating on the complete set of instances of a class | | static method | static | | | | | | 1 class | 0 or more class variables of its class | method | | | | the class as a whole, not a particular instance of the class | | | the super method to invoke a method declared in the superclass | | | | 'this' value when it is executing | A method that is invoked without reference to a particular object | | public except for those that will definitely need to be called from outside the package | |
deprecated method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | | | | | | | | | | a class or an object | | method | | | | | | | 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 | A method that has been replaced by a different method in a later version of Java | | public except for those that will definitely need to be called from outside the package | |
final method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | to increase efficiency by eliminating dynamic method lookup | | | | | | | | | a class or an object | | method | | | | | | | the super method to invoke a method declared in the superclass | by any method | | | a comment at its head if the method is non-obvious | A method that cannot be hidden or overridden | | public except for those that will definitely need to be called from outside the package | |
finalize method | | | | | Garbage Collection | | | | finalize | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | to clean up an object before the object is garbage collected | | | | | | | | | a class or an object | | method | an object before the object is garbage collected | | | | | | 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 | A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state | | public except for those that will definitely need to be called from outside the package | |
instance method | | | public, protected or private | | Methods | | | the object itself using the 'this' keyword | | other methods and variables in any class in the same package by default | | | a class such that there is no needless duplication of it, and such that it is useful in all the subclasses of the class in which it is defined | | | return statement unless it has a void return type | | | | | | public float credit(float amountToCredit) { balance = balance + amountToCredit; return balance; } | | the behaviour of the objects in the class | | every class variable of its class | a class | the current object's instance variables | method | | | | | | | 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 | Any method that is invoked with respect to an instance of a class | | public except for those that will definitely need to be called from outside the package | |
long method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | | | more than 20 lines of code | | | | | | | | | | | a class or an object | | method | | | | | | | 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 | | shorter methods | public except for those that will definitely need to be called from outside the package | |
method declared in an interface | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | | | | | | | | public and abstract | | a class or an object | | method | | | | | | | 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 | | | static | |
method declared without an access modifier | | | more private in a subclass | | | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | | | | | | | | | | a class or an object | | method | | | | | | | 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 | | | public except for those that will definitely need to be called from outside the package | |
overridden method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | | | | | | | | | | a class or an object | | method | | super.myMethod(a,b) | | | | | the super method to invoke a method declared in the superclass | a method in a superclass with the same name | use the 'super' keyword | | 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 | |
overriding method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | | | | | | | | | | a class or an object | | method | | | | | | | 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 | | | public except for those that will definitely need to be called from outside the package | |
println | | method | | | Example Methods | | | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | | | | | System.out.println("This line will be printed"); | | | | | a class or an object | | | | | | | | | the super method to invoke a method declared in the superclass | a method in a superclass with the same name | | | specification | | | public except for those that will definitely need to be called from outside the package | |
private method | | | | | Methods | | | | | code in the same class | | | | | | return statement unless it has a void return type | | | | | | | | | | | a class or an object | | method | | | | | | subclasses | 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 | | | public except for those that will definitely need to be called from outside the package | |
protected method | | | | | Methods | | | | | code in the same package as this class as well as code in any subclasses, even if they are not in the same package | | | | | | return statement unless it has a void return type | | | | | | | private method in subclass | | | | a class or an object | | method | | | | | | | 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 | | | protected or public in all subclasses | |
public method | | | | | Methods | | | | | any code anywhere | | | | | | return statement unless it has a void return type | | | | | | | | | | | a class or an object | | method | | | | | | subclasses | 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 | | | public in all subclasses | |
recursive method | | | | | Methods | | | | | other methods and variables in any class in the same package by default | | | | calling itself to solve a subproblem until the subproblem is simple enough to solve directly | | return statement unless it has a void return type | | | | | | //Recursive method to compute the nth power of 2
public static int recursivePowerOf2 (int n) { if (n == 0) { return 1; } else { return 2 * recursivePowerOf2(n-1); } } | | | | | a class or an object | | method | | | | | | | recursion | a method in a superclass with the same name | | | a comment at its head if the method is non-obvious | A method that calls itself | | public except for those that will definitely need to be called from outside the package | |
substring | | method | | | Strings | | a new String with a sequence of characters from the original string | | | other methods and variables in any class in the same package by default | | | | | | return statement unless it has a void return type | | to extract part of a string | | | | String sub = "submariner".substring(0,3); // = "sub" | | | | | a class or an object | | | | | | | | | the super method to invoke a method declared in the superclass | a method in a superclass with the same name | | starting position and ending position + 1 | specification | | | public except for those that will definitely need to be called from outside the package | |