What does the code mean?
man.wife = woman;
woman.husband = man;
Why is a variable set like this?
man.wife
woman.husband
And what is the value of this variable?
How can it be used?
And the main thing: why variables are set like this - through a point, using a point?
Why code is written like this: man.wife = woman; woman.husband = man; ?
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Novel Geek
18 April 2019, 14:03
The variables man and woman are defined as a set of different strings which give the information about them, so when you want to access particular variables within the set you use mainname.subvariable
For example if you have
public class Student
{
String name;
int roll number;
String grade;
}
To give each variable a value you have to access them as Student.name, Student.roll number etc.,
0