bonjour
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
package javaapplication1;
public class Potpie
{
 private int month;
 private int day;
 private int year;
 public Potpie(int m,int d,int y)
 {
     month=m;
     day=d;
     year=y;
     System.out.printf("The constructor for this is %s\n",this);
 }
 public String toString()
 {
     return String.format("%d/%d/%d",month,day,year);
 }
}
package javaapplication1;
public class Tuna
{
    private String name;
    private Potpie birthday;
 
 
    public Tuna(String theName,Potpie theDate)
    {
        name=theName;
        birthday=theDate;
    }
    public String toString()
    {
        return String.format("My name is %s","my birthday is %s",name,birthday);
    }
}
package javaapplication1;
public class Apples
{
 public static void main(String[]args)
   {
     Potpie potObject=new Potpie (4,5,6);
     Tuna tunaObject=new Tuna ("Greg",potObject);
     System.out.println(tunaObject);   
   }
)
le resutat de mon programe est suivant
The constructor for this is 4/5/6
My name is my birthday is %s

mais je veux que le resultat soit ainsi:
The constructor for this is 4/5/6
My name is Greg,my birthday is 4/5/6

quelqu'un peut m'aider pour trouver mon erreur s'il vous plaît