Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Overloaded method...i'm confused..?

The overloaded printString method is defined as follows:

public static void printString( String s )

{

System.out.println( s );

}

public static void printString( String s, int n )

{

if ( s.length() > n )

printString( s.substring( 0, n ) );

else

printString( s );

}

Okay, so one of these strings will cause the String "Scrum" to be printed to the output window. Which one?

printString( "Scrump" );

printString( "Scrumptious" );

printString( "Scrumptious", 4 );

printString( "Scrumptious", 5 ); ---> I have a feeling its this one, but I'm not positive.

printString( "Scrumptious", 6 );

--I am a beginner and do not have Java installed on my computer-

1 Answer

Relevance
  • steele
    Lv 6
    1 decade ago
    Favorite Answer

    printString( "Scrumptious", 5 );

    5 = five characters

Still have questions? Get your answers by asking now.