Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Parrot Information Display Challenge | Classes
Java Extended
course content

Course Content

Java Extended

Java Extended

1. Deep Java Structure
2. Methods
3. String Advanced
4. Classes
5. Classes Advanced

bookParrot Information Display Challenge

Task

Your task is to write a toString() method that will display all the information about the parrot.

  1. In the toString() method, use the return keyword to specify the output of the method.
  2. Start by creating a string, either using concatenation or string formatting, beginning with something like Parrot{.
  3. Add each field to the string, using + for concatenation, and include both the field name and its value (e.g., "name='" + name + "'").
  4. Separate each field with a comma and a space for better readability.
  5. End the string with a closing brace } to properly represent the object.
  6. Finally, return the formatted string from the toString() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 9
toggle bottom row

bookParrot Information Display Challenge

Task

Your task is to write a toString() method that will display all the information about the parrot.

  1. In the toString() method, use the return keyword to specify the output of the method.
  2. Start by creating a string, either using concatenation or string formatting, beginning with something like Parrot{.
  3. Add each field to the string, using + for concatenation, and include both the field name and its value (e.g., "name='" + name + "'").
  4. Separate each field with a comma and a space for better readability.
  5. End the string with a closing brace } to properly represent the object.
  6. Finally, return the formatted string from the toString() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 9
toggle bottom row

bookParrot Information Display Challenge

Task

Your task is to write a toString() method that will display all the information about the parrot.

  1. In the toString() method, use the return keyword to specify the output of the method.
  2. Start by creating a string, either using concatenation or string formatting, beginning with something like Parrot{.
  3. Add each field to the string, using + for concatenation, and include both the field name and its value (e.g., "name='" + name + "'").
  4. Separate each field with a comma and a space for better readability.
  5. End the string with a closing brace } to properly represent the object.
  6. Finally, return the formatted string from the toString() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Task

Your task is to write a toString() method that will display all the information about the parrot.

  1. In the toString() method, use the return keyword to specify the output of the method.
  2. Start by creating a string, either using concatenation or string formatting, beginning with something like Parrot{.
  3. Add each field to the string, using + for concatenation, and include both the field name and its value (e.g., "name='" + name + "'").
  4. Separate each field with a comma and a space for better readability.
  5. End the string with a closing brace } to properly represent the object.
  6. Finally, return the formatted string from the toString() method.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 9
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt