Answer the question
In order to leave comments, you need to log in
How does this piece of code work?
I created the variable Man(variable type) man(Variable name) = new Man()(Type of the Created Object).
How does this code work?
public static void main(String[] args) {
Man man = new Man();
Woman woman = new Woman();
woman.husband = man;
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;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question