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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:49:35+00:00 2026-05-29T11:49:35+00:00

I program in Java and have been trying to understand exactly what operator overloading

  • 0

I program in Java and have been trying to understand exactly what operator overloading is. I’m still a bit puzzled.

An operator can take on different meanings depending on which class uses it? I’ve read that it is “Name Polymorphism”.

Java apparently does not support it and there seems to be a lot of controversy around this. Should I worry about this?

As a last question, in an assignment the teacher has stated that the assignment uses operator overloading, he is a C++ programmer mainly but we are allowed to write the assignment in Java. since Java does not support overloading, is there something I should be wary of?

  • 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-29T11:49:36+00:00Added an answer on May 29, 2026 at 11:49 am

    Operator overloading basically means to use the same operator for different data types. And get different but similar behaviour because of this.

    Java indeed doesn’t support this but any situation where something like this could be useful, you can easily work around it in Java.

    The only overloaded operator in Java is the arithmetic + operator. When used with numbers (int, long, double etc.), it adds them, just as you would expect. When used with String objects, it concatenates them. For example:

    String a = "This is ";
    String b = " a String";
    String c = a + b;
    System.out.print (c);
    

    This would print the following on the screen: This is a String.

    This is the only situation in Java in which you can talk about operator overloading.

    Regarding your assignment: if the requirement is to do something that involves operator overloading, you can’t do this in Java. Ask your teacher exactly what language you are allowed to use for this particular assignment. You will most likely need to do it in C++.

    PS: In case of Integer, Long, Double etc. objects, it would also work because of unboxing.

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

Sidebar

Related Questions

I have been trying some different java compilers over the weekend and decided to
I have been asked to write a java program on linux platform. According to
We have a Java program run as root on Unix, that therefore can read
I have been trying to set up a program that sends a push notification
For quite awhile I have been trying to make a simple game in Java
I have been a Java programmer for a while and I am trying to
So I have been given a C program, which I am trying to make
I have been trying to get a simple networking test program to run with
I've been trying to run my java program overnight but I need to restart
I have been trying to write some Java bytecode and assemble it using Jasmin.

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.