// Rectangle(Dimension d)
// Constructs a new Rectangle whose top left corner is (0, 0)
// and whose width and height are specified by the Dimension argument.
// Dimension(Dimension d)
// Creates an instance of Dimension whose width and height
// are the same as for the specified dimension
import java.awt.Dimension;
import java.awt.Rectangle;
public class TestJava {
public static void main(String[] args) {
Dimension d = new Dimension(100, 100);
Rectangle square = new Rectangle(d);
System.out.println(square);
}
}
How to use API doc(demo) to create s square rectangle?
最新推荐文章于 2023-10-20 15:13:10 发布