19. Overloaded println()


Answer:

Yes. The names of the formal parameters do not have to be unique.

Overloaded println()

We have already been using overloading. The println() method (for example) has several overloaded versions:

      • println( )
      • println( boolean x )
      • println( char x )
      • println( double x )
      • println( int x )
      • println( String x )
      • ... others

Which version of println() gets called depends on the argument.


Question 19:

Which version of println() is called in the following:

    System.out.println( "The result is: " + 34 );