Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8500255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:53:45+00:00 2026-06-11T00:53:45+00:00

I created a Dimension and a Point object but I do not need to

  • 0

I created a Dimension and a Point object but I do not need to name both of these objects and call its constructor inside the argument of the method call. May I have an explanation why this is possible? I have been far too used to giving my objects name that I am need explanation to my question.

import java.awt.Dimension;
    import java.awt.Point;

    import javax.swing.JFrame;


    public class GameFrame extends JFrame {

        public GameFrame()
        {

            // call this method to the GameFrame object 
            // if you do not call this method the JFrame subclass will not actually close
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            // set size to an appropriate size
            // create a dimension object 
            setSize(new Dimension(600,600));

            // upon creating the object set the location of the frame to the center of the screen
            setLocation(new Point (500,300));

            // prevent the user from resizing the GameFrame object
            setResizable(false);
        }

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:53:46+00:00Added an answer on June 11, 2026 at 12:53 am

    When you write

    setSize(new Dimension(600,600));
    

    you are actually saving a reference of the Dimension object as you create the object and pass it to the method.

    This works well and recommended if you need not use the object further for any computation separately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi dimensional array, like this: array('name' => array('title'=>'Title','date'=>'Created')) I store it
I have created a class that extends JLabel to use as my object moving
I asked this before, but only theoretically, without an SSCCE. Now, I've created one,
I need to create a large two dimensional array of objects. I've read some
I created 2 car objects using my CarPanel. Then I used to keylistener to
I have a data structure created using read.csv() of dimensions 130, 395. I am
I'm trying to create my first data mart. I am creating my dimension table
Someone know some interesting and complete tutorial about how to create a Parent-Child dimension
I need to create a method to generate a unit vector in three dimensions
I am tracking an object that is thrown in the air, and this object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.