Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7682747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:38:22+00:00 2026-05-31T18:38:22+00:00

This is my homework, but please read my problem description first. I have to

  • 0

This is my homework, but please read my problem description first.

I have to write a Java program as

a. Path of the directory will be passed to the program as command line argument. Then program will prompt for a file name and find all the files with that name.
If no argument is passed, program should search directory from previous run. Do not use any database.

b. If user types exit/quit/bye, program will stop execution.

Problem description:

*My problem is that question says that I have to take directory name from command line and if it is not passed I have to take previous entered directory. But when we pass command line argument we need to run the program. It means each time I have to run the program to pass command line args. So how can I remember the previous one if argument not passed (as in question I can’t use database). *

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:38:24+00:00Added an answer on May 31, 2026 at 6:38 pm

    I don’t really understand what do you mean with “program should search directory from previous run”. So i will try to answer 2 possibilities :

    1. previous run from the same session. ( that just being run )

      In the order to do this you should create a singleton that store all
      of run in ArrayList, and get the latest path. Memento pattern might also be another solution for this.

    2. previous run from same/different session ( means maybe run yesterday, or last month, or last year ) and the computer might have been turned off between each run.

      For this, I think you should write the path to a default file using FileWriter or BufferedWriter. And then create
      a FileReader or BufferedReader to read from this file to get the last
      path being run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is one of my homework exercise. Write a shell program, which will take
So first off, this is a homework assignment, so please don't write any code
This is for homework but please know that I have looked online for help
Okay - yes, this is homework, but it isn't mine. I have a friend
This is my homework and I have thought a lot about it but I
First of all, this is not homework, so please don't tag it as homewrok
I have done a homework assignment, here is the problem statement: Your program should
yes, this is a homework-type question but could you please help me out? In
This is a homework I have for my Operative Systems class... This program sums
First of all this is homework. I have been trying to get rid of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.