About Question enthuware.ocajp.i.v8.2.862 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
Rinkesh
Posts: 35
Joined: Sat Nov 25, 2017 4:13 pm
Contact:

About Question enthuware.ocajp.i.v8.2.862 :

Post by Rinkesh »

This will not compile because Java does not allow operator overloading for user defined classes.

Can you explain this with a example??

admin
Site Admin
Posts: 10398
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.862 :

Post by admin »

Operator overloading allows you to define new behavior for existing operators such a +, - etc. You can do that in C/C++, but not in Java. You can see examples in c/c++ https://en.wikibooks.org/wiki/C%2B%2B_P ... verloading
but not in Java because it is not allowed.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 8 guests