0

Ive just noticed this kind of syntax:

 System.out.<String>println("...");

If we look at method println:

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

Its not parametrized, so how complier dont give a warning? Thx for your time

CoderFromKPI
  • 15
  • 1
  • 5

1 Answers1

1

The code makes no sense and of course has to not be used as whatever the generic type you specify, it has the same effect : nothing but a warning at compile time explaining that the type argument is not used as the method is not generic.

davidxxx
  • 125,838
  • 23
  • 214
  • 215