Primitives datatypes
The current object is represented by the this
keywords. An access to an attribute or the called of an operation is then expressed by this.attribute
or this.operation()
; thus, an expression such as attribute=value;
is translated into this.attribute=value;
- Improvement:
this
keyword
public class Person {
private Date birthdate;
public Person(Date birthdate) { this.setBirthDate(birthdate); }
public void setBirthDate(Date birthdate) { this.birthdate = birthdate; }
public Date getBirthDate() { return this.birthdate; }
}
- As an exercicse, how to extend
Person
s with the following characteristics ?
- 'weight', 'height' ? => float/Float
- 'married' ? => boolean/Boolean
- 'name' ? => String
16 - 17Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented