In the main method, create a Man object and save a reference to it in the variable man.
Also, create a Woman object and save a reference to it in the variable woman.
Hint: Use the following construct to create a Woman object and assign a reference to that object to the variable woman:
VariableType variableName = new TypeOfObjectBeingCreated();
Save a reference to the previously created Woman object in man.wife.
Save a reference to the previously created Man object in woman.husband (Hint: woman.husband = man).
package com.codegym.task.task02.task0204;
/*
Family relations
*/
public class Solution {
public static void main(String[] args) {
//write your code here =
Man man = new Man();
Woman woman = new Woman() ;
man.wife.int = new Woman () ;
}
public static class Man {
int age;
int height;
int wife;
}
public static class Woman {
public int age;
public int height;
public int me;
}
}