What's the cat's name?

  • 4
  • Locked
The first thing a person/robot/variable receives after it is born/spawned/created is a name. Our brains aren't very comfortable with the idea of a world without names and titles. Let's come to their rescue: let's create a special automated naming method that sets the value of the private String variable name, i.e. names the object.
You can't complete this task, because you're not signed in.
Comments (11)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Michael Scanlan
Level 4 , Kalispell, United States
27 January 2021, 01:07
Hope this link helps someone else as well. It provides a list of Java commands with explanations and helped me figure out some of these exercises: • Java Command Explenations
Constantin Anton
Level 7 , Coventry, United Kingdom
27 August 2020, 10:15
Does this.name is the name inside the method and normal name is the global one inside Class ?
Level 41
4 September 2020, 14:27
This is what I am thinking yes. But it does not accept name = this.name.
Constantin Anton
Level 7 , Coventry, United Kingdom
2 January 2021, 14:26
Hard for us romanian native speakers to properly understand english requirements. I can see you level up so you fixed this ?
Level 41
4 January 2021, 08:18
Yes, I did all of them, even though it was very difficult. But it is worth it.
Level 4 , Netherlands
26 January 2020, 17:35
looking at the previous example I did Cat.name = name; why is this wrong. I am so confused when to use this. and when to use Cat.
Level 4 , Łódź, Poland
10 March 2020, 14:28
lI'm late, but still: You should use this.name instead of cat.name it's something with visibility of variables - method setName can't see class Cat - but I have no idea why
Level 10
16 April 2020, 03:55
Cat.name is to be used only when you are using static variables that cannot be changed.For none static and declared in a class, you should use this.blahblahblah
Level 8 , Den Haag, Netherlands
3 August 2020, 22:21
thank you this was really helpful
Tyler Evans
Level 6 , Wallasey, United Kingdom
20 August 2020, 20:39
Thank JAKUB you beautiful man. you get a kudos from me.
Level 7 , Princeton, NJ, usa
25 December 2019, 19:35
What is wrong here. It compiles and uses the argument