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

  • Home
  • SEARCH
  • 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 7832153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:04:01+00:00 2026-06-02T12:04:01+00:00

I am confused to as why the Java Point class takes in two int

  • 0

I am confused to as why the Java Point class takes in two int paramaters and the getX() and getY() methods return doubles.
For example I could define a Point

Point p = new Point(4,6);

If I were to call..

p.getX();

It would return 4.0. and if I were to call

p.x;

I would get 4.

Any reason for this?

  • 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-02T12:04:03+00:00Added an answer on June 2, 2026 at 12:04 pm

    There are Point2D.Double and Point2D.Float classes that extend Point2D which is a superclass of Point and they need to be able to work with floating point values. Note that there is also a setLocation( double, double ).

    Point2D is an abstract class that implements the distance calculation for points, and setLocation, getX, and getY are its abstract methods, which is why they all use doubles and why Point has to implement them with doubles in the signature.

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

Sidebar

Related Questions

I'm confused by the following code: import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public class
For an assignment I need to create a class within class Point from java.awt.Point.
Example 1 /** *Program Name: Cis36L0411.java *Discussion: Class -- Data Members ONLY * Method
I might be confused between hashmap in Java, and map / dict in Python.
I'm a newbie to Java and I'm confused about something: In the simple hello
I'm new in the Java world and I'm totally confused with the sheer number
I'm learning generics in Java from C++ and am confused how to do math
When I read the java concurrency in practice c03, I was confused by the
I am trying to profile my java application with JProbe. I am little confused
I'm new in netbeans and java swing, but also confused. I put some JLabel's

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.