Making Rectangles – Intro to Java Programming


Because this project has multiple classes, I have to select the one that I want. And now, I can scroll through in the usual way and see the methods of the rectangle class. But I want to go a little bit above that and here you see a summary of the constructors. There are two constructors, the first one takes no arguments and constructs an empty rectangle. The second one takes four arguments. And I can click on it, and I get the detailed description of what each of the arguments are. To construct objects in a Java program, you also use the new syntax. Let’s have a look. Over here, you see a variable whose name is box, whose type is rectangle. And the keyword new tells us to make a new rectangle with these values for the construction. Now you know all the details about construcitng objects.

2 thoughts on “Making Rectangles – Intro to Java Programming

Leave a Reply

Your email address will not be published. Required fields are marked *