Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// I am trying to get text from .txt file (I ask for it using a readLine(); however it is giving me an error. Please

// I am trying to get text from .txt file (I ask for it using a readLine(); however it is giving me an error. Please have a look at my code, and can you tell me what the error is:

import stdlib.In; import stdlib.StdIn; import stdlib.StdOut;

public class StringSorter {

public static void main(String[] args) { StdOut.print("File to read in: "); String filename= StdIn.readLine(); In infile= new In(filename); String [] ourArray= infile.readAllStrings(); Insertion.sort(ourArray); for (int i= 0; i < ourArray.length; i++) { StdOut.println(ourArray[i]); } } }

//Best regards

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

1. Who is responsible for resolving this dilemma?

Answered: 1 week ago