SUPERCLASS, METHOD, OBJECT, BUILDERS, THIS, METHODS OVERLOAD
SUPERCLASS
The highest class, the class from which all others descend, is the Object class defined in java.lang. Object is the root of the inheritance of all kinds.
In this hierarchical structure, each class has only one parent class. The parent class of any kind is known as superclass. The child class is called a superclass of a subclass.
* A superclass can have any number of subclasses.
* A subclass can have only one superclass.
A is the superclass of B, C and D.
D is the superclass of E.
B, C and D are subclasses of A.
E is a subclass of D.
METHODS
You could say that there are two main types of methods, the first type of method are methods that perform processes can perform any operation with them, but the purpose is to manipulate existing variables (RETURNING A DATA). The second type of methods are those that perform a process or calculation (SETUP), and calculate a specific variable, an example could be a method to get the value of a multiplication. We used to encapsulate some functionality, which can be called from different places and not have to repeat the code.
OBJECT
An object stores its state in fields ('variables' in some programming languages) and shows its behavior through methods ('functions' in some programming languages). The methods operate on the internal state of the object and serve as the primary mechanism for communication between objects. Hiding internal state and requiring all interaction takes place through the methods of an object is known as data encapsulation - a fundamental principle of object-oriented programming.
BUILDERS
A constructor is a special method of a class that is automatically called whenever an object of that class is declared.
Its function is to initialize the object and serves to ensure that objects always contain valid values.
The primary mission of the constructor is to allocate memory variables and initial lifting class members.
You can create an object from another of the same class constructor called writing a copy constructor.
This constructor copies the attributes of an existing object to the object being created.
Builders copy has a single argument, which is a reference to an object of the same class from which we will copy.
For example, for the class date we can write a copy constructor that allows to create objects with the values of an existing:
Date date = new Date (1, 1.2011);
Date date1 = new Date (date);
The default constructor is a constructor without parameters does nothing. Object attributes are initiated by the system default values.
THIS
Uses the this when an attribute is hidden by a variable declaration or parameter.
Many methods of an object need to access this data member, and other properties of the object. For this reason is that the Java language, along with the implementation of a method as the argument object reference that is running the member. To explicitly refer to this reference from the method we use the this keyword. That is nothing but a reference to the object that is running the method.
METHODS OVERLOAD
Method overloading is creating multiple methods with the same name but different signatures and definitions. Java uses the number and type of arguments to select which method definition to execute.
Unlike Java overloaded methods based on the number and type of arguments that has the method and not the return type.
The highest class, the class from which all others descend, is the Object class defined in java.lang. Object is the root of the inheritance of all kinds.
In this hierarchical structure, each class has only one parent class. The parent class of any kind is known as superclass. The child class is called a superclass of a subclass.
* A superclass can have any number of subclasses.
* A subclass can have only one superclass.
A is the superclass of B, C and D.
D is the superclass of E.
B, C and D are subclasses of A.
E is a subclass of D.
METHODS
You could say that there are two main types of methods, the first type of method are methods that perform processes can perform any operation with them, but the purpose is to manipulate existing variables (RETURNING A DATA). The second type of methods are those that perform a process or calculation (SETUP), and calculate a specific variable, an example could be a method to get the value of a multiplication. We used to encapsulate some functionality, which can be called from different places and not have to repeat the code.
OBJECT
An object stores its state in fields ('variables' in some programming languages) and shows its behavior through methods ('functions' in some programming languages). The methods operate on the internal state of the object and serve as the primary mechanism for communication between objects. Hiding internal state and requiring all interaction takes place through the methods of an object is known as data encapsulation - a fundamental principle of object-oriented programming.
BUILDERS
A constructor is a special method of a class that is automatically called whenever an object of that class is declared.
Its function is to initialize the object and serves to ensure that objects always contain valid values.
The primary mission of the constructor is to allocate memory variables and initial lifting class members.
You can create an object from another of the same class constructor called writing a copy constructor.
This constructor copies the attributes of an existing object to the object being created.
Builders copy has a single argument, which is a reference to an object of the same class from which we will copy.
For example, for the class date we can write a copy constructor that allows to create objects with the values of an existing:
Date date = new Date (1, 1.2011);
Date date1 = new Date (date);
The default constructor is a constructor without parameters does nothing. Object attributes are initiated by the system default values.
THIS
Uses the this when an attribute is hidden by a variable declaration or parameter.
Many methods of an object need to access this data member, and other properties of the object. For this reason is that the Java language, along with the implementation of a method as the argument object reference that is running the member. To explicitly refer to this reference from the method we use the this keyword. That is nothing but a reference to the object that is running the method.
METHODS OVERLOAD
Method overloading is creating multiple methods with the same name but different signatures and definitions. Java uses the number and type of arguments to select which method definition to execute.
Unlike Java overloaded methods based on the number and type of arguments that has the method and not the return type.
Comentarios
Publicar un comentario