Bonjour,
Je ne comprends pas comment enregistrer une référence pour homme et femme. Pourriez vous m'indiquer comment faire?
package fr.codegym.task.task02.task0204;
/*
Relations familiales
*/
public class Solution {
public static void main(String[] args) {
Homme homme = new Homme();
Femme femme = new Femme();
homme.epouse = new Femme();
femme.mari = new Homme();//écris ton code ici
}
public static class Homme {
public int age;
public int taille;
public Femme epouse;
}
public static class Femme {
public int age;
public int taille;
public Homme mari;
}
}