I have a class like this:
private static class Num {
private int val;
public Num(int val) {
this.val = val;
}
}
Is it
There is no operators overloading in java. The only thing which is supported for objects, is string concatenations via "+". If you have a sequences of objects joined via "+" and at least one of them is a String, then the result will be inlined to String creation. Example:
Integer a = 5;
Object b = new Object();
String str = "Test" + a + b;
will be inlined to
String str = new StringBuilder("Test").append(a).append(b).toString();