Is there any way to overload the assigment operator or it is not possible in java?
Thank you very much
xxmp
0
Light Poster
Recommended Answers
Jump to PostNo, it's not.
What is it that you want to achieve? - there may be other ways to get the desired result.
Jump to PostNo, AFAIK there's no way (and quite right too!). There are no default params either, although you can overload the fn to have versions with and without the defaultable params (having come to Java from Smalltalk I do miss that one)
Jump to PostNo overloading in Java, except what's already in the language (string concatenation by +, for example).
Default parameters you could do by overloading the method name.
public int bogusMethod() { return bogusMethod(5); //call this method using 5 as default } public int bogusMethod(int parameter) { // …
All 11 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
xxmp
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
jon.kiparsky
326
Posting Virtuoso
xxmp
0
Light Poster
xxmp
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
xxmp
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
xxmp
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.