About 47,700,000 results
Open links in new tab
  1. java - Constructing Rectangle - Stack Overflow

    First of all, we need to have our Rectangle class. public class Rectangle { } There! We've defined a Rectangle class, for making Rectangle objects. Now, it needs some properties. We'll say …

  2. Rectangle (Java Platform SE 8 ) - Oracle

    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's upper-left point (x,y) in the coordinate space, its width, and its height. A Rectangle object's …

  3. Create a Rectangle class in Java and calculate area, perimeter

    Sep 7, 2021 · With this tutorial, you will learn how to create a class in Java and how to access its methods and parameters. We will follow the following steps: Create one Rectangle class. This …

  4. Java Program to Find out the Area and Perimeter of Rectangle

    Jul 23, 2022 · The main task here is to create a class that can be used to find the Area and Perimeter of a rectangle. By using the formula for Area of Rectangle and Perimeter of …

  5. Create a New Java Class Rectangle – Java Program

    Jul 10, 2019 · How To Create a New Rectangle Class in Java. Write a Java program using Objects and Classes concepts in Object Oriented Programming. Define the Rectangle class …

  6. Creating a rectangle class in Java - java problems

    Create a class Rectangle. The class has attributes length and width , each of which defaults to 1. It has methods that calculate the perimeter and the area of the rectangle.

  7. Creating an Object

    In Java, you create an object by creating an instance of a class or, in other words, instantiating a class. To create a new object, use Java's new operator. Here's an example using the new …

  8. Java: Calculate area and perimeter of a rectangle - w3resource

    May 17, 2025 · Java Object Oriented Programming - Create a class called Rectangle with width and height attributes, calculates the area and perimeter of the rectangle, and demonstrates …

  9. How to create a Rectangle class in Java? - Stack Overflow

    Rectangle(int x1,int y1,int x2,int y2) { x1 = p1.x; y1 = p1.y; x2 = p2.x; y2 = p2.y; } your variables p1 and p2 haven't been initialized to anything, since before that, all you do is declare those two …

  10. Class java.awt.Rectangle - University of Washington

    Constructs a new rectangle whose top left corner is (0, 0) and whose width and height are specified by the dimension argument. Constructs a new rectangle whose top-left corner is …