Java View all facts Glossary Help |
member > instance member > instance method > method that is declared in Object class > getClass |
getClass | ||||
subject | fact |
getClass | has specification | |
has example //Returns the name of the class of the object called key String name = key.getClass().getName(); | ||
is a subtopic of Example Methods | ||
is an instance of final method | ||
is an instance of method that is declared in Object class | ||
returns a runtime representation of the class of the object | ||
final method | cannot be overridden by any method | |
has purpose to increase efficiency by eliminating dynamic method lookup | ||
method |
| |
| ||
belongs to a class | ||
can access all instance variables of all objects of its class | ||
can be inherited by subclasses of its class | ||
can be accessed by other methods and variables in any class in the same package by default | ||
can use the super method to invoke a method declared in the superclass | ||
cannot be passed as an argument to a method or constructor | ||
creates an object by instantiating a class | ||
has part method definition | ||
has part method signature | ||
has part a block of implementation code | ||
implements | ||
is equivalent to the terms "function member" or "member function" which are used in C++ | ||
is equivalent to the terms "routine", "function" or "method" which are used in non object-oriented programming languages | ||
is part of a class or an object | ||
may contain empty return statement if it has a void return type | ||
may have access modifier | ||
must contain return statement unless it has a void return type | ||
must define its parameter list | ||
must define its return type | ||
should be as private as possible | ||
should not be public except for those that will definitely need to be called from outside the package | ||
should return to its caller from only one place which should be the last statement | ||
usually hides instance variables, class variables from other objects | ||
instance method | can operate on the current object's instance variables | |
can refer to the object itself using the 'this' keyword | ||
has access to every class variable of its class | ||
implements the behaviour of the objects in the class | ||
is part of a class | ||
may be declared public, protected or private | ||
should be placed in 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 | ||
access unit | has access mode | |
syntactic unit | has syntax rule bold = mandatory |