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 7068157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:17:23+00:00 2026-05-28T05:17:23+00:00

i am working on a project that has an object called Vector2 public static

  • 0

i am working on a project that has an object called Vector2

public static class Vector2 {
        public Vector2 (float x, float y) {
            this.x = x;
            this.y = y;
        }

        public float x;
        public float y;

        public static Vector2 ZERO = new Vector2 (0, 0);
        public static Vector2 FORWARD = new Vector2 (0, 1);
        public static Vector2 LEFT = new Vector2 (1, 0);

        public static float Distance (Vector2 a, Vector2 b) {
            return (float) Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
        }
    }

and would like to do the following:

Vector2 a = new Vector2 (2.32, 453.12);
Vector2 b = new Vector2 (35.32, 532.32);

Vector2 c = a * b;

// c.x = 2.32*35.32
// c.y = 453.12*532.32

float num = 5;
c = a * num;

// c.x = 2.32*5
// c.y = 453.12*5

Is this possible? If so how can I do it, and what is it called? Thanks in advance.

  • 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-05-28T05:17:24+00:00Added an answer on May 28, 2026 at 5:17 am

    No, Java does not support operator overloading.

    As an FYI: if it’s possible for you to work with other languages, then C++ and, the very Java like, C# do support operator overloading. If your project, for example Ray Tracing, has a lot of vector related operations, then I’d actually consider a language like C#.

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

Sidebar

Related Questions

I'm working on a project that has a rich object model with various sets
I am working in a project that has two main parts: a class library
I am working on a project that has a class 'A' that contains a
We' re working on a project that has a relational object model and we
I have a class module in an Excel project that has a property called
I am working on a project that has grown to a decent size, and
I am working on a project that has a requirement such that login details
I have been working on a project that has 2 interfaces - windows forms
I'm currently working on a project that has scope to become quite large, however
I'm currently working on a project that has a svn repository. I'm used to

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.