Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; import java.io.*; public class Main { // public static void main(String[] args) throws FileNotFoundException { try{ FileReader file = new FileReader(file3.txt); Scanner input

import java.util.Scanner; import java.io.*; public class Main { // public static void main(String[] args) throws FileNotFoundException { try{ FileReader file = new FileReader("file3.txt"); Scanner input = new Scanner(file); //Prints out the values in the document. Doesn't store them //while ( input.hasNext() ) // System.out.println(input.next()); //Storing values into an array String [] words = new String [1]; int i = 0; //index do{ //System.out.println(i); words[i] = input.next(); if(input.hasNext()){ //increase the size of words String [] temp = new String [words.length + 1]; for (int j = 0; j < words.length; j++) temp[j] = words[j]; words = temp; //replace the old with the new } i++; }while( input.hasNext() ); //words now holds all of the text in the document file System.out.println("Words has " + words.length + " items in it."); System.out.println("Words has " + words[0] + " as the first value."); //backwards! for (int k = words.length - 1; k >= 0; k--) { System.out.println(words[k] + " "); } //method calls go here. //end output input.close(); } catch (FileNotFoundException e){ System.out.println("File not found"); } }//ends main method //methods go below here //methods go above here }//ends the class

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

what address do I had to put under the registered agent name

Answered: 1 week ago

Question

Why do organizations need managers???????????????????

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago

Question

Define Conventional Marketing.

Answered: 1 week ago