Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What will the following code print out when it is run? Scanner fileIn = new Scanner(new File(fileIn.txt)); int count = 0; while (fileIn.hasNextLine()) {

image text in transcribed 

What will the following code print out when it is run? Scanner fileIn = new Scanner(new File("fileIn.txt")); int count = 0; while (fileIn.hasNextLine()) { String str = fileIn.nextLine().trim(); if (str.indexOf('?') >= 0) { count++; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis And Decision Making

Authors: Christian Albright, Wayne Winston, Christopher Zappe

4th Edition

538476125, 978-0538476126

More Books

Students also viewed these Programming questions