class : set of variables, constructors and methods. A class holds a name that
it will be compiled as javac name.java and executed as java name (with JDK : java
Developpement Kit compiler).
Concstructor: a function, with the same name as the class (name (...)), and that
contains or not the declared variables. These variables will be used to construct
the object of the class.
Method: a function or a procedure that manipulate the object. In this case, the
method is satatic. If it doesn't deal with the object it is not static.
Variable: If a variable deals with the object, then it's a variable object. If
not, it's then a class variable.
Field: All the separated members of the class holding data of the object
or the class are called fields.
Instance: An istance is the fresh duilt object: the related sytax is:
Constructor Instance = new Constructor(...);
A class is instantiated when its constructor is called.
Making an object is equivalent to create an instance of a class.
Instance variable and instance methods are the variable and methods used
when an instance is declared.
Modifiers (access modifiers): To set visibilty, a the name of class may be preceded
by a modifier such as:
- public: visible from everywhere. In the directory (or package), where it is made,
a class can be compiled and executed without the public modifier. The related fields
followa the same rule.
- private: Fields (variables or methods) may be used only by an instance of the
same class. This class which declares the variable or method,
- protected: Field are available to all subclasses of the class and all the
classes in the same package.
Without any access modifier, the related class becomes a default class.
NB. main mehod must be always public. Class is either public
abstract. Fields are public, private or protected.
Type: Describes the kind of a variable or method like int, double, boolean, String,
Object,.... A method (function) that returns nothing takes void as type.
extends: A class extends (inherits) from its super (mother) class, but it implements
another class which is abstract ( with all fields abstract). A class can extends one
class and implements many classes from the set called Interface. An abstarct class
cannot be instantiated.
static: Field associated with a class rather than an object. Static fields are attached
to a class, not an object.
final: Field that can not be changed. A class is declared as final if it can
not be extended.
|
|