Linked Questions

6 votes
6 answers
5k views

Possible Duplicate: Java operator overload In c++, we can perform the operator overloading. But Java is also a Object oriented language. So why java doesn't support overloading?
user315463's user avatar
1 vote
1 answer
352 views

Everyone knows how simple arithmetic in Java works for primitives: int one = 1,two = 2,three = one + two; double four = (one + two) / three; if(four % 1 == 0){ System.out.println("Yay for simple ...
Sarah Szabo's user avatar
  • 10.9k
3413 votes
36 answers
4.1m views

I wanted to create a list of options for testing purposes. At first, I did this: ArrayList<String> places = new ArrayList<String>(); places.add("Buenos Aires"); places.add("Córdoba"); ...
Macarse's user avatar
  • 93.3k
119 votes
31 answers
446k views

My understanding is that C/C++ produces native code to run on a particular machine architecture. Conversely, languages like Java and C# run on top of a virtual machine which abstracts away the native ...
210 votes
11 answers
258k views

Please can you tell me if it is possible to overload operators in Java? If it is used anywhere in Java could you please tell me about it.
Vipul's user avatar
  • 2,675
111 votes
10 answers
31k views

I'd like to hear what is the motivation behind the bulk of sealed classes in the .Net framework. What is the benefit of sealing a class? I cannot fathom how not allowing inheritance can be useful and ...
mmiika's user avatar
  • 10.4k
18 votes
10 answers
34k views

Why doesn't Java need operator overloading? Is there any way it can be supported in Java?
pure.java's user avatar
  • 781
35 votes
3 answers
40k views

The following example is from the book 'Programming in Scala'. Given a class 'Rational' and the following method definition: def add(that: Rational): Rational = new Rational( this.numer * ...
jason's user avatar
  • 425
12 votes
7 answers
46k views

I am attempting to create a unsigned integer class. public class UnsignedInteger extends Number implements Comparable<UnsignedInteger> { ... } Is there a way to implement ...
Jay Tomten's user avatar
  • 1,717
26 votes
4 answers
35k views

How to make two objects in Java comparable using "<" or ">" e.g. MyObject<String> obj1= new MyObject<String>(“blablabla”, 25); MyObject<String> obj2= new MyObject<String>(“...
IvanN's user avatar
  • 327
11 votes
5 answers
11k views

Acordding to my knowledge in java I know, that there is no operator overloading in the Java language. So, why this code prints 'true' twice ? String s1 = "abc"; String s2 = "abc"; System....
Oz Molaim's user avatar
  • 2,176
14 votes
5 answers
9k views

I have a class like this: private static class Num { private int val; public Num(int val) { this.val = val; } } Is it possible to add to objects of the class by using the "+"-...
multiholle's user avatar
  • 3,210
29 votes
1 answer
9k views

Is there a list anywhere of all ruby operators that can be overridden? (Not the ones that can't!)
aaaidan's user avatar
  • 7,386
16 votes
3 answers
2k views

Can I create a class that instantiates with just the = operator, like the String class does? Or is that a feature specific to String class in Java?
matthew's user avatar
  • 179
17 votes
2 answers
4k views

Even looking closely over documentation on Clojure, I do not see any direct confirmation as to whether or not Clojure supports operator overloading. If it does, could someone provide me with a quick ...
Ryan Delucchi's user avatar

15 30 50 per page