Class Dimension in Java

Class Dimension in Java
Class Dimension in Java

Class Dimension in Java:

This class encapsulates the width and height of a component into a single object. The class structure  of Class Dimension in Java is given as:

public class java.awt.Dimension extends java.lang.Object{
//member elements:
public int height;//height of the component
public int width;//width of the component
//constructors:
public Dimension();//creates a Dimension object with height and width as zero.
public Dimension(Dimension d);//Creates a Dimension whose width and height are
//same as provided in the given dimension.
public Dimension(int width,int height);//creates a Dimension with the specified 
//width and height.
//Method
public String toString();
//Returns a String representation of the Dimension.
}
 
Class Dimension in Java Class Dimension in Java Reviewed by Animesh Chatterjee on January 02, 2019 Rating: 5

No comments:

Powered by Blogger.