Why is following code not correct?
Shouldn't we use variable type when creating new variables?
What does "woman.husband" and "man.wife" (the dot) mean please?
Man woman.husband = man;
Woman man.wife = woman;
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 woman.husband = man;
Woman man.wife = woman;
}
public static class Man {
public int age;
public int height;
public Woman wife;
}
public static class Woman {
public int age;
public int height;
public Man husband;
}
}