Hello Paul!
I would like to ask a question, perhaps it is a little bit silly because my understanding in English is not really great.
with the statement,
d=d +1;
"This will not compile because Java does not allow operator overloading for user defined objects."
This means that we can not use operator overloading for created objects?
Thank you very much Paul
About Question enthuware.ocajp.i.v8.2.862 :
Moderators: Site Manager, fjwalraven
-
- Posts: 66
- Joined: Mon Feb 20, 2017 12:31 pm
- Contact:
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.862 :
Actually, you are right. The statement is not proper. It should say, "This will not compile because Java does not allow operator overloading for user defined classes."
Java overloads the + operator only for String class. It does not allow this operator to be used with any other class unless one of the operands is a String.
hope this helps and thank you for your feedback!
Paul.
Java overloads the + operator only for String class. It does not allow this operator to be used with any other class unless one of the operands is a String.
hope this helps and thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 66
- Joined: Mon Feb 20, 2017 12:31 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.862 :
Thank you very much Paul!
I understand it much more clear now!
I understand it much more clear now!
Who is online
Users browsing this forum: No registered users and 22 guests