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.
}

Don't miss out!

Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address

Give it a try. You can unsubscribe at any time.

Thanks for subscribing! Please check your email for further instructions.

I am the founder and owner of the blog - TechTravelHub.com, always love to share knowledge on test automation,tools,techniques and tips.I am a passionate coder of Java and VBScript.I also publish articles on Travel ideas and great honeymoon destinations.Apart from these, I am a gear-head,love to drive across India. I have shared lots of articles here on How to travel several parts of India.Customization of cars aka car modification is my another hobby.Get in touch with me on [email protected]