Solved

The File Numbers

Question 94

Essay

The file numbers.txt contains only positive integers. We want to calculate the maximum value among them. Complete the code below.
int max = 0;
try
{
Scanner scan = new Scanner( new File( "numbers.txt" ) );
// Your code goes here
scan.close( );
}
catch( Exception e )
{ }
System.out.println( "max = " + max );

Correct Answer:

verifed

Verified

while ( scan.hasNext...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions