Please TYPE the program, execute it, and capture outputs Modify it so that it write the contents of String[] into a file named fileLoop1.txt Include the program, files, and output in a Word doc //...



  1. Please TYPE the program, execute it, and capture outputs

  2. Modify it so that it write the contents of String[] into a file named

    fileLoop1.txt

  3. Include the program, files, and output in a Word doc



//


package stringio;



//


//


import java.util.Scanner;


import java.io.*;


//


public class Stringio {



    //


    public static void main(String[] args) throws IOException


    {


        File loopfile = new File("fileLoop.txt");



    Scanner getAll = new Scanner( loopfile );      // connect a Scanner to the file


    String num;


    String[] items = new String[10];


    int i = 0;


    while(getAll.hasNextLine()){


      num = getAll.nextLine();


     // square = num * num ;


      //System.out.println("The square of " + num + " is " + square);


      items[i] = num;


      System.out.println("items[i] is " + items[i]);


      i = i + 1;


    }


    getAll.close();


    }



}



Jun 02, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here