Let's make up our own invisible friends, give them some qualities, and then go play with them, just like the other loners do! No? Okay, another time. We'll get through today by creating a friend template, i.e. a Friend class. And we'll make up three initializers for it: name, age and sex; only name and age; and only name.
Create a Friend class
- 4
Locked
Comments (6)
- Popular
- New
- Old
You must be signed in to leave a comment
EvelynSt
12 October 2022, 04:54
Hint
public void initialize(String name)
{
this.filename = name;
// file name is not any file name but field name
}
0
Johannes
3 March 2020, 07:15
Requirements list "Name", but when marking, it requires "name", please fix bug ?
thanks :)
+1
Roman
6 March 2020, 09:01
Where?
Requirements:
• The Friend class must have a String variable name.
• The Friend class must have an int variable age.
• The Friend class must have a char variable sex.
• The class must have an initialize method that takes a name as an argument and initializes the corresponding instance variable.
• The class must have an initialize method that takes a name and age as arguments, and initializes the corresponding instance variables.
• The class must have an initialize method that takes a name, age, and sex as arguments, and initializes the corresponding instance variables.
0
Johannes
6 March 2020, 10:17
Create the Friend class with three initializers (three initialize methods):
- Name
- Name, age
- Name, age, sex
+1
Roman
10 March 2020, 07:25
This "Name" is not a variable name)
+1
Turner
27 July 2019, 15:47
Many 'initialize' programs are PRIVATE. Please clarify in your requirements. Also, correct your (N)ame parameter in the Friend class. It is NOT helpful having conflicting requirements.
+3