Code Monkey home page Code Monkey logo

java-mod-3-java-nio-lab's Introduction

Java NIO Lab

Learning Goals

  • Practice reading and writing a text file using the Files class from the java.nio package.

Instructions

Given the GroceryListDriver class again, modify the program to use the Files class from the java.nio package to read and write a text file.

Reuse the last lab to modify the methods you already wrote to use the new classes we just learned about.

To implement the reading and writing of a text file, consider the following instructions and tips:

  • Modify the GroceryListDriver class.
    • Rewrite the method to write to a text file.
      • Use the writeString() method to write to a text file.
      • Each item in the list should be on its own new line.
      • Refer back to the Java NIO lesson.
    • Rewrite the method to read a text file line-by-line.
      • Use either the readString() method or the readAllLines() method to read from the text file.
      • Return a String to print out to the console the list of groceries.
      • Refer back to the Java NIO lesson.
  • When running the GroceryListDriver class, pass in a file named grocery-list.txt.
  • Remove the @Disabled annotation from the unit tests and ensure that the tests pass successfully. Refactor as needed.

java-mod-3-java-nio-lab's People

Contributors

kcleland0818 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

austinbaik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.