![]() ![]() ![]() ![]() Two overloaded constructors - a default constructor with no argument, and a constructor which takes a double argument for radius.Two public methods: getRadius() and getArea(), which return the radius and area of this instance, respectively.The source codes for Circle.java is as follows: /** * The Circle class models a circle with a radius and color. ("color is: " + c4.getColor()) // Print color via getter // You cannot do the following because setRadius() returns void, which cannot be printed ("radius is: " + c4.getRadius()) // Print radius via getter Modify the TestCircle to test these methods, e.g.,Ĭircle c4 = new Circle() // construct an instance of Circle ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |