What is the output of this code sequence? try { Scanner file = new Scanner(new F
ID: 3548313 • Letter: W
Question
What is the output of this code sequence?
try
{
Scanner file = new Scanner(new File("data.txt"));
int n = 0;
while(file.hasNext();
if (s.equals("A"))
n++;
}
System.out.println("The value of n is " + n);
file.close();
}
catch(IOException ioe)
{
ioe.printStackTrace();
)
Explanation / Answer
The value of n is 3
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.