-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersonne.java
More file actions
50 lines (43 loc) · 972 Bytes
/
Personne.java
File metadata and controls
50 lines (43 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.*;
public class Personne {
public int Age;
public String Nom;
public Personne (String Nom, int Age ) {
this.Nom = Nom ;
this.Age = Age ;
}
public Personne (int Age ) {
this.Age = Age ;
this.Nom = " " ;
}
public Personne (String Nom ) {
this.Nom = Nom ;
this.Age = 0 ;
}
public Personne () {
this.Nom = " " ;
this.Age = 0 ;
}
public void setAge(int Age){
this.Age = Age;
}
public void setNom(String Nom){
this.Nom = Nom;
}
public int getAge(){
return Age;
}
public String toString(){
return ( "(*" + Nom + "," + Age + "*)" );
}
public static void main(String[] args) {
Personne a = new Personne ( " toto " , 34 ) ;
Personne b = new Personne ( " tata " ) ;
Personne c = new Personne ( ) ;
b.setAge ( 56 ) ;
c.setNom ( "titi" ) ;
c.setAge ( 12 ) ;
System.out.println(a.getAge()) ; // d o i t a f f i c h e r 34
System.out.println(a) ; // d o i t a f f i c h e r (∗ t o t o , 3 4 ∗)
}
}