Question: Write a method called longestName that accepts a Scanner for the console and an integer as parameters and prompts for names, then prints the longest

Write a method called longestName that accepts a Scanner for the console and an integer as parameters and prompts for names, then prints the longest name (the name that contains the most characters) in the format shown below, which might result from a call of longestName(console, 4):

name #1? Roy

name #2? DANE

name #3? sTeFaNiE

name #4? Mariana

Stefanie's name is longest

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static void longest Name Sca... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!