Skip to main content

Java Topic Practice

Text Files and Scanner

Practice mode with 15 Java-focused questions, immediate answer checks, and explanations.

For practice use only.

Text Files and Scanner MCQ Practice

Text Files and Scanner Java practice with 15 questions, code tracing, and a worked explanation for every answer.

Question 1 of 15

Answered 0 of 15

Choose one answer.

What is printed by the following code segment?

Scanner s = new Scanner("12 7 3");
int t = 0;
while (s.hasNext())
{
    t += s.nextInt();
}
System.out.print(t);
Choose one answer.