Question: File Input Lab Read the first 10,000 words in the book Journey to the Center of the Earth (included with the lab) into a String

File Input Lab

Read the first 10,000 words in the book Journey to the Center of the Earth (included with the lab) into a String array of size 10,000 in the main method. Write a method called evenWords, which gets all the even words and puts them into an array of size 5000 and returns the array. Back in main print out the last 100 words in the array.

I have the .txt file on hand and this has to be done in java oracle under one class

EDIT: Here is what I have so far

import java.io.File; import java.io.IOException; import java.util.Scanner; public class FileInputLab {

public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File myFile = new File("C:/Users/Richie/Documents/workspace/LastLab/src/textFile.txt"); Scanner inputFile = new Scanner(myFile); String[] myArray = new String[10000]; for(int i = 0; i<10000; i++){ myArray[i] = inputFile.next(); }

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!