Sponsored Links

Interview Questions
Recommended Books












INTERVIEW QUESTIONS J2EE CORE JAVA DETAILS
Question :

Why operator overloading is not there in java?

Category Core Java Interview Questions
Rating (2.9) By 34 users
Added on 8/24/2014
Views 337
Rate it!

Highly Recommended, Hand Picked Core Java Books



Question :

Why operator overloading is not there in java?


Answer:

Source: CoolInterview.com

C++ has proven by example that operator overloading makes code almost impossible to maintain. In fact there very nearly wasn?t even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note that some of the classes like DataOutputStream have unoverloaded methods like writeInt() and writeByte().
Source: CoolInterview.com



Source: CoolInterview.com

I belive Operator Overloading exists in Java.

For ex:
Operator + :

'+' has been over ridden to add when its used with number. The '+' operator is also used as Concatenating operator in case of Strings.

Plz let me know in case of any clarification required.



Source: CoolInterview.com



Posted by: Divya

Contact Divya Contact Divya

Source: CoolInterview.com

Operator overloading makes the code more complex and less readable. Also we could define different methods in the same class like plus(),plusplus(), minus() etc and thus bringing operator overloading in Java
Source: CoolInterview.com



Posted by: Ponnu

Contact Ponnu Contact Ponnu

Source: CoolInterview.com

I guess,Operator overloading is not supported in Java as its create lot of confusion instead of solving the problems.


Source: CoolInterview.com



Posted by: Venu

Contact Venu Contact Venu

Source: CoolInterview.com

Operator Overloading
An operator is overloaded if it is bound to multiple definitions. When the operator is used in an expression,
which definition to use is determined based on the number and type of the operands. Examples:
? in Java, + is used both for addition and string concatenation
? in almost all programming languages, the arithmetic operators (+, -, *, ...) are overloaded to work
on both integer and floating point types. Note that integer addition and floating point addition are
different operations in assembly language.
Notes on overloading:
? many languages (C++, Ada, C#) allow the programmer to overload operators
? Java does not
? overloading can help program readability if the overloaded meaning of the operator is similar to the
standard meaning
? overloading can hurt program readability if the overloaded meanings of the operator are very different
from each other and/or the standard meaning
? overloading can reduce reliability by weakening the compiler's ability to detect type errors
? by definition, overloading must always be resolved statically. The compiler must be able to determine
which meaning is meant by the (static) types of the operands.

Source: CoolInterview.com



Posted by: Geetha Adhikeshavalu

Contact Geetha Adhikeshavalu Contact Geetha Adhikeshavalu

If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification Enter the above shown code: *
Inform me about updated answers to this question

Related Questions
View Answer
What modifiers are allowed for methods in an Interface?
View Answer
What is a local, member and a class variable?
View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View ALL Core Java Interview Questions & Answers



User Options
India News Network

Latest 20 Questions
What are the Hadoop related Projects at Apache?
What are the modules included in Apache Hadoop Project?
What is Apache Hadoop?
What is a Private Cloud? Do we need one to handle Big Data?
How Can We Cope with the Impact of Big Data?
What skills do Big Data analysts need to have?
What does a Big Data analyst do?
What are some real-world examples of Big Data and how it is used?
What is Big Data Analytics?
Why Big Data is becoming so important?
What is the impact of Big Data on Sports Industry?
What is the impact of Big Data on Real estate Industry?
What is the impact of Big Data on Retail Banking Industry?
What is the impact of Big Data on Retail Industry?
What is the impact of Big Data on Technology Industry?
What is the impact of Big Data on Information Technology Industry?
What is the impact of Big Data on Internet of Things (IoT) Industry?
What is the impact of Big Data on Media Industry?
What is the impact of Big Data on Education Industry?
What is the impact of Big Data on Healthcare Industry?



Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |




Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions



Cache = 0.003906 Seconds