The Student class has its private attributes and to access or modify them requires the use of the get and set methods. In addition, the Student class implements the Comparable interface.
class Estudante implements Comparable<Estudante> {...
Let's say I have the following class:
class animal{
private $animal;
private $som;
function gato(){
$this->animal = 'gato';
return $this;
}
function cachorro(){
$this->animal = 'cachorro';...
I'm continuing my studies on object-oriented Java programming.
I'm currently studying encapsulation and get and set methods and came across the following exercise:
Encapsulate the value attribute of the Ticket class.
...
I have a class Ponto :
public class Ponto {
public int x;
public int y;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}...