0

Java doesn't support operator overloading. If so then in the following code:

System.out.println( "I am" + "a programmer");

+ is concatenating string.

Isn't it operator overloading?

Seemab
  • 1
  • 1

1 Answers1

2

These are println methods in PrintStream class

 public void println(int x) {
        synchronized (this) {
            print(x);
            newLine();
        }
    }

public void println(String x) {
    synchronized (this) {
        print(x);
        newLine();
    }
}

so println(2+3) means println(5) and it calls println(int x)

Saeed Masoumi
  • 9,349
  • 6
  • 55
  • 75