Write a complete Java class that can be used to create a Fish object as described below: A Fish has-a: - name age - type - favorite food a) Add all instance variables b) The class must have getters and setters for all instance variables c) The class must have two constructors: a no-args constructor and a constructor that receives all data fields as parameters d) The class must have a toString() e) Add a main method and create 2 Fishes using each of the constructors you created

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question
Write a complete Java class that can be used to create a Fish
object as described below:
A Fish has-a:
- name
age
- type
favorite food
a) Add all instance variables
b) The class must have getters and setters for all instance variables
c) The class must have two constructors: a no-args constructor and a constructor that
receives all data fields as parameters
d) The class must have a toString()
e) Add a main method and create 2 Fishes using each of the constructors
you
created
Transcribed Image Text:Write a complete Java class that can be used to create a Fish object as described below: A Fish has-a: - name age - type favorite food a) Add all instance variables b) The class must have getters and setters for all instance variables c) The class must have two constructors: a no-args constructor and a constructor that receives all data fields as parameters d) The class must have a toString() e) Add a main method and create 2 Fishes using each of the constructors you created
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,