Ask Question
5 January, 03:35

Write an overloaded constructor for the Table class that will take a single argument for the color of the table Write a set method (also known as a mutator method) for the color attribute.

+4
Answers (1)
  1. 5 January, 03:48
    0
    Below is required code in java : -

    public class Table{

    private String color; / /attribute to store the color of the table

    public Table () { / /default constructor

    this. color=""; / /set a default blank color

    }

    public Table (String color) { / /overloaded constructor

    this. color=color; / /set the color value equal to the parameter provided

    }

    public void setColor (String color) { / /setter or mutator method

    this. color=color; / /set the color value equal to the parameter provided

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write an overloaded constructor for the Table class that will take a single argument for the color of the table Write a set method (also ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers