You have a text of some book in the file book.txt. You need to read it using a scanner, print all lines from the file. Your friend tried to help you, but he wrote code lines in the wrong order and without indentation. Please, correct the code.
Exceptions and resources
Read a book
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
}
while (it.hasNext()) {
}
}
val scanner = Scanner(File("book.txt"))
println(it.nextLine())
scanner.use {
fun main() {
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.